How to refactor web.config in an ASP.NET MVC4 Web App with EF5 and Database First approach?

89 views Asked by At

I started an ASP.NET MVC4 Web App with EF5 and the Db First approach. Now i´ve moved my Models and Context into a MyApp.DataAccess Class Library Project. I added a MyApp.DataAccess reference to MyApp.Web. What do I have to do with my Web.config and especially this section:

<connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=..." />
    <add name="MyOldEntities" connectionString="metadata=res://*/Models.OldDbModel.csdl|res://*/Models.OldDbModel.ssdl|res://*/Models.OldDbModel.msl;provider=System.Data.SqlClient;provider connection string='data source=&quot;<MyDbServerIp, MyPort>&quot;;initial <LoginData>;MultipleActiveResultSets=True;App=EntityFramework'>" providerName="System.Data.EntityClient" />
  </connectionStrings>

edit: error message: Unable to load the specified metadata resource

1

There are 1 answers

2
Frank On

based on this answer, i have to change

connectionString="metadata=...App=EntityFramework'"

to

connectionString="metadata=...application name=EntityFramework'"