C# – The mapping of CLR type to EDM type is ambiguous with EF 6 & 5

centity-frameworkentity-framework-4

Please any one can help me to fix this error?

Schema specified is not valid. Errors:

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'.

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?

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

Thank you

Best Answer

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.

Related Topic