Closed arman-m closed 1 year ago
I need you to share a repro
Thanks, Erik for taking the time. While I was trying to create a smaller project to illustrate the issue, I figured out what's causing it. We have 2 classes inherited from DbContext
and in their default constructor both of them were using a named connection string with the same name. I renamed one of them and everything started working as before.
I have an existing ASP.NET WebForms application which I converted to use Microsoft.Data.SqlClient with ErikEJ.EntityFramework.SqlServer library and it is working, although to Regenerate Views I have to change provider in the connection string back to System.Data.SqlClient. I have another console application which is using the same EF context but every time I try to query the context I get the following error
The current model no longer matches the model used to pre-generate the mapping views, as indicated by the ViewsForBaseEntitySets8660e3bff6fec2d8af82f3fdbe8da4e92b2ca78ffb8ccc99fdee86d39b2dfd55.MappingHashValue property. Pre-generated mapping views must be either regenerated using the current model or removed if mapping views generated at runtime should be used instead. See http://go.microsoft.com/fwlink/?LinkId=318050 for more information on Entity Framework mapping views.
This is ONLY happening in the console app. The WebForms application works fine. I use XML/App.Config based configuration:I have installed EntityFramework 6.4, ErikEJ.EntityFramework.SqlServer and Microsoft.Data.SqlClient nuget packages in the console app. I have no idea how to get around this issue. Any help would be appreciated.