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 but both databases have same schema.I have added their edmx files in different folders to separate namespaces but still I am getting this 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'.

My question is how can I use two edmx files which are apparently same but from different data sources

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

Accepted Answer

Yes, it is a known bug in Entity Framework 6 and below. You could not use the same databases even though they are on different namespaces. This is happening in code first design as well and a post was opened on GitHub regarding the issue as well.

One of the developers even answered it stating:

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.

Meaning, that if you use Entity Framework 6 or below there is not much for you to do except not using the same Database twice 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