none
CLR type to EDM type is ambiguous - same class name in different namespaces RRS feed

  • Question

  • Schema specified is not valid. Errors:
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Account'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.Account', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.Account'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'StockAccount'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.StockAccount', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.StockAccount'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Category'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.Category', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.Category'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Currency'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.Currency', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.Currency'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Transaction'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.Transaction', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.Transaction'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'SubCategory'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.SubCategory', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.SubCategory'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'StockInvestment'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.StockInvestment', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.StockInvestment'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'BankAccount'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.BankAccount', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.BankAccount'.
    The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Contragent'. Previously found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlCe.Contragent', newly found CLR type 'MoneyManagerNET.DAL.Repository.EF4.SqlClient.Contragent'.
    .NET guy
    Sunday, September 25, 2011 11:04 AM

Answers

All replies

  • Hi tsadigov;

    How did you create your EDMX model?
    Did you create multiple EMDX with some of the same tables in the same namespace?

    By the sounds of it you have multiple classes with the same name such as Account, StockAccount and others.


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Sunday, September 25, 2011 2:18 PM
  • Actually I copied it, I want to support SqlCe
    so I edited in xml editor, changed provider, removed "schema=dbo"


    actually I found the reason that is because EntityFramework when mapping CSDL entity to a CLR type searches by name and doesnt take into account the namespace (this is sooo strange, I should be able to specify the exact class). I copied two edmx files to different projects and both work fine.

     

    actually what Im trying to do is allow user change config file and use storage that he wants in a little test project http://moneymanagernet.codeplex.com/

     

    but what if I have a need to host different models in one assembly and they have entities with colliding names? EntityFramework ignores namespace


    .NET guy
    Sunday, September 25, 2011 6:36 PM
  • Hi tsadigov;

    Please see this post Tip: Multiple ObjectContext’s In a Single Project

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by Larcolais Gong Wednesday, October 5, 2011 5:07 AM
    Monday, September 26, 2011 1:22 PM