Reputation: 81
I was trying to update the return values of a stored procedure but for some reason Entity Framework tells me there is no connection for this model (cfr. first screenshot). Due to this problem I am unable to update the function nor the complex type.
Whenever I click the button Update Model from Database... I am prompted with the Update Wizard.
This is what the connection string looks like in the app.config file.
<connectionStrings>
<add name="WeighingEntities"
connectionString="metadata=res://*/Model.Weighing.WeighingModel.csdl|res://*/Model.Weighing.WeighingModel.ssdl|res://*/Model.Weighing.WeighingModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=sql2016;Initial Catalog=db2;Persist Security Info=True;User ID=user;Password=password;MultipleActiveResultSets=True;Application Name=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
This is a WPF application, I am using EntityFramewrok 6.2.0 and the project is using the .NET Framework 4.5 and my IDE is Visual Studio 2017. This was working previously. The database is working properly. I tried to add the data connection again using the Update Wizard. I did delete and recreate the .edmx. I also tried to delete the connection string in the file and then use the Update Wizard in order to recreate it.
None of my attemps did change anything I am still getting the message:
No database connection has been configured for this model.
How can I get EF6 to work again?
Upvotes: 4
Views: 1007
Reputation: 121
Well I just got punished by this, so here's the solution.
It is an undocumented magic string match... great.
In the EDMX editor properties, there is a setting titled Entity Container Name
This has to match the connection string name in App.config
Upvotes: 1
Reputation: 81
I have a workaround but it does not solve the underlying issue:
- Delete the Stored Procedure, the Function Import and the Complex Type in the .edmx file
- Use the UpdateWizard to reimport the StoredProcedure
Upvotes: 1