Entity Framework: Unable to load the specified metadata resource

后端 未结 2 1548
醉梦人生
醉梦人生 2021-01-01 01:08

I decided to move Entity Connection String from app.config to code. However after setting it up like this:

    public static string         


        
相关标签:
2条回答
  • 2021-01-01 01:55

    After reading this answers article and this blog I changed:

      entity.Metadata = @"res://*/Data.System.csdl|res://*/Data.System.ssdl|res://*/Data.System.msl";
    

    To:

      entity.Metadata = "res://*/";
    

    And it works :-)

    0 讨论(0)
  • 2021-01-01 01:56

    I upgraded to the new csproj format(Visual studio 2017 with simple format) after that I started getting this error. The csproj has a feature where you don't need to include each file instead it includes all the relevant files under the folder by default so the entity framework files are treated same way so those are not embedded into the assembly by default.

    I need to go and manually change the build action of my edml file(edmx in case of Microsoft entity framework) to 'DevartEntityDeploy' (I hope it is EntityDeploy for Microsoft Entity framework)and build it which solved my problem

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