开发者

How to fix type names conflicts in Dynamic Data

We're working in a Dynamic Data project that will handle entities comin开发者_开发百科g from two different namespaces: myModel.Abby and myModel.Ben.

whose classes are:


Abby

myModel.Abby.Car

myModel.Abby.Lollipop

Ben

myModel.Ben.Car

myModel.Ben.Apple

So myModel.Abby.Car and myModel.Ben.Car are homonym. when I try to register both ObjectContext's, an exception is thrown telling us that there are type name conflicts between the mentioned classes (although the types belong to different namespaces).

How can we overcome type-name conflicts, caused by repeated type names among different namespaces?


I don't think there is a way around this.

DynamicData routes to the correct forms based on type names. Look in the URL, the type name is always up there someplace. How can DD know which type you mean to interact with?


Here is a workaround from MSDN

The problem is a naming conflict between types in 2 different contexts. To get around this you can rename one of the classes specifying the TableNameAttribute on your entity.

Hope it helps others. : )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜