EF4.3.1 on .NET 4 - The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type

二次信任 提交于 2019-12-05 00:06:40

I think I got to the bottom of it today.

It looks to me that the enum type lives in a separate assembly and the cast triggers loading types from this assembly. This assembly happens to contain the type 'DTO.A' which matches the 'Entities.A' type. This cause the ambiguity which in turn causes an exception to be thrown. Note that did not happen in .NET Framework 4 since enum types in EF4 were not supported and cast operation did not cause loading types from the other assembly so for projects targeting .NET Framework 4 this is a regression in .NET Framework 4.5. In EF6 the behavior will be the same regardless of .NET Framework version - we will always throw.

TomBean

Dean,

This is a known issue as reported in the following links:

http://entityframework.codeplex.com/workitem/483

http://entityframework.codeplex.com/workitem/589

The namespace is ignored by the Entity Framework so the same tables in multiple databases cause the problem because the Entity Framework only looks at the table name.

Apparently, the Entity Framework team doesn't understand the importance of supporting whatever database schema customers have. They also have lost sight of the fact that clean compiling code should also run.

If you look at the links I mentioned above, you will see that correcting their errors have a low priority. I don't know about you but I'd be fired over that attitude.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!