Entity Framework error - “The EntityContainer name must be unique”

前端 未结 10 2270
南旧
南旧 2021-02-07 09:24

We have a solution which consists of two projects - a console application project and a web application project. Each of these has an identical in schema, but differently named

相关标签:
10条回答
  • 2021-02-07 09:56

    This error occurs when you have more than one entity model.edmx files in a single DLL or class library project. Although the reason behind the error is not known to me , you can fix this by deleting the other model or moving the other model.edmx file to another class library .

    Also dont forget to remove the references of the previous dll

    0 讨论(0)
  • 2021-02-07 10:04

    My Entities were in another class library (MyLibrary.Data). Changing below worked :

    <add name="Entities" connectionString="metadata=res://*/;&#xA;         provider=MySql.Data.MySqlClient; .....
    
    <add name="Entities" connectionString="metadata=res://MyLibrary.Data;&#xA;         provider=MySql.Data.MySqlClient;
    
    0 讨论(0)
  • 2021-02-07 10:05

    When faced with this problem in the past, I've always created a third, shared library that contains the entity model - that way you know there's not going to be a name conflict, if you decide to add a new table/column/method to the model you only need to do so once, etc, etc.

    0 讨论(0)
  • 2021-02-07 10:08

    Go to that bin folder and delete dll and pdb file manually.

    0 讨论(0)
提交回复
热议问题