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

This error occurred in our application with a particular case when we stored two procedures with the same name in two different databases. These databases were internally related. We used Entity Framework database first approach for our application.

As 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 a single model, the EDMX could not differentiate the two classes generated from the stored procedures. So it threw this particular error-

[code language=”xml”]
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type
[/code]

So the solution is:

  • Don’t use classes with the same unqualified name.
  • Name your stored procedures differently even if they’re in separate databases if you’re planning to use them in a single BLL.

Leave a Reply

Your email address will not be published. Required fields are marked *