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

  • Question

  • In my project I would use at least 2 different EDMX file for different MySQL DB that have some identical table (same field with same name). I've created the EDMX from DB and at first query I get the error "The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type".

    What could I do to use EF with more than one DB that has similar tables ?

    I couldn't change DB structure (table names and field names).

    Thank you

    Monday, January 12, 2015 3:51 PM

Answers

  • Hello Domenico,

    >> What could I do to use EF with more than one DB that has similar tables ?

    As far as I know, Entity Framework uses only class names to identify the type mapped in EDMX and namespaces are ignored - it is a convention to allow mapping classes from different namespaces to single model. From your description, it seems that you would have two same named entities and because of the reason I mentioned above, it throws the error.

    Although you could modify the DB structure, you could change the entity names in your application:

    1.Open your Entity Framework designer model =>

    2.Right click the entity which causes this error and select Rename, type whatever name you want.

    For other entities which could also causes this exception, you could do the same with it.

    Then although tables would contain same table name, their mapped CLR types are different.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 13, 2015 2:21 AM
    Moderator