The EntityContainer name must be unique. An EntityContainer with the name 'Entities' is already defined

前端 未结 12 1007
孤城傲影
孤城傲影 2020-12-15 03:11

For a little background:

I have a DLL project with the following structure:

Rivworks.Model (project)  
  \\Negotiation (folder)  
      Model.edmx          


        
12条回答
  •  鱼传尺愫
    2020-12-15 03:25

    The other cause of this problem, your add model in any solution project and change your model project.

    --PROJECT A --> MODEL.EDMX
    
    --- WEB CONFIG -->Entity Connection
    
    --PROJECT B
    
    --- WEB CONFIG -->Entity Connection
    

    Later, I think this structure is bad and Change project.

    --PROJECT A
    using PROJECT.C;
    WEB.CONFIG - USE PROJECT C APP.CONFIG CONNECTIONSTRING 
    
    --PROJECT B
    using PROJECT.C;
    WEB.CONFIG - USE PROJECT C APP.CONFIG CONNECTIONSTRING 
    
    --PROJECT C  (CLASS LIBRARY) --> MODEL.EDMX 
    --- APP.CONFIG -->Entity Connection
    

    Everything was fine but I get an error. Error Detail : The EntityContainer name must be unique. An EntityContainer with the name 'Entities' is already defined

    Because I forgot change Web.Config files.

    OLD WEB.CONFIG

        
    

    NEW WEB.CONFIG

     
    

    This Problem is Simple but may cause loss of time. I wanted to give an example. I hope is useful.

    Thanks.

提交回复
热议问题