I get the following error when trying to add a controller with CRUD actions and EF:
Unable to retrieve metadata for LetLord.Models.Tenant. Using the same DbCompiledModel to create contexts for different types of databases is not supported. Instead, create a separate DbCompiledModel for each server you use.
Add controller dialog settings:
Template: MVC controller with read / write actions and views using EF.
Model Class: Tenant (LetLord.Models)
Data Context Class: LetLordContext (LetLord.Models)
I saw similar questions / problems and tried the suggested solutions, but I can't get it to work.
My connection string:
<connectionStrings> <add name="LetLordContext" connectionString="Data Source=|DataDirectory|LetLord.Models.LetLordContext.sdf" providerName="System.Data.SqlServerCe.4.0" /> </connectionStrings>
In LetLordContext.cs I do not have a default constructor. In the class InitializeSimpleMembershipAttribute.cs I call
WebSecurity.InitializeDatabaseConnection("LetLordContext", "UserProfile", "UserId", "UserName", autoCreateTables: true);
What I tried:
- Change the name of my provider as described in different questions.
- I deleted the connection string and commented on it.
- Uninstall and reinstall the Entity Framework.
- Verify that SQL Server CE 4.0 is installed.
- Going back to an earlier version of my subversive project.
I am still at a loss, so any help would be greatly appreciated.
source share