Ans Bilal
Ans Bilal

Reputation: 1067

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

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

Upvotes: 0

Views: 1790

Answers (1)

Barr J
Barr J

Reputation: 10919

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.

Upvotes: 3

Related Questions