The mapping of CLR type to EDM type is ambiguous because multiple CLR types

asp.net-mvc c# entity-framework-6

Question

I have two databases, yet their schemas are identical. Even after I put their edmx files to distinct namespaces in different directories, I continue to get the following exception:

The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'bettingoffer'. Previously found CLR type 'SpocosyPanel.Data.Tennis.bettingoffer', newly found CLR type 'SpocosyPanel.Data.Soccer.bettingoffer'.

How can I utilise two edmx files that seem to be identical but came from distinct data sources?

1
0
8/19/2018 8:56:26 AM

Accepted Answer

Yes, Entity Framework versions 6 and down have this known problem. Despite being in distinct namespaces, you cannot utilise the same databases. Additionally, this is occurring with code first design, and a post about the problem was made on GitHub.

Even one of the programmers replied, saying:

This is already supported in the EF7 code base. We didn't really do anything to explicitly support it, it was just a side effect of the lighterweight purpose built metadata system in EF7 smile.

Therefore, the only thing you really need to do if you're using Entity Framework 6 or earlier is to avoid utilising the same database more than once in your code.

2
8/19/2018 8:49:28 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow