CLR 类型到 EDM 类型的映射与 EF 6 & 不明确.5?

CLR 类型到 EDM 类型的映射与 EF 6 & 不明确.5?

问题描述:

请问有人能帮我解决这个错误吗?

Please any one can help me to fix this error?

指定的架构无效.错误:

Schema specified is not valid. Errors:

CLR 类型到 EDM 类型的映射是不明确的,因为多个 CLR 类型匹配 EDM 类型City_DAL".之前发现CLR类型'CeossDAL.City_DAL',新发现CLR类型'CeossBLL.City_DAL'.

The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'City_DAL'. Previously found CLR type 'CeossDAL.City_DAL', newly found CLR type 'CeossBLL.City_DAL'.

我有 DAL 的主要问题,它包含 EF 和 BLL,它包含 DAL 的相同类,但命名空间不同,这就是导致问题的原因

The main problem that I have DAL and this contains the EF and BLL and this contains the same classes of the DAL but differ in the namespace and this is what cause the problem

我不知道如何摆脱这些问题,你能帮我吗?

I can't know how to get rid of these problem, can you please help me?

如果有人给我使用带有 EF 的 n 层架构的示例,我将不胜感激

Also I will be appreciated if some one give me sample to use n-tier architecture with EF

谢谢

不要使用具有相同非限定名称的类 - EF 仅使用类名来标识 EDMX 中映射的类型(命名空间是忽略) - 这是一个约定,允许将类从不同的命名空间映射到单个模型.您的问题的解决方案是在 BLL 中以不同的方式命名您的类.

Don't use classes with the same unqualified name - EF uses only class names to identify the type mapped in EDMX (namespaces are ignored) - it is a convention to allow mapping classes from different namespaces to single model. The solution for your problem is to name your classes in BLL differently.