Sono nuovo in MVC 5 e sto cercando di configurare l'autorizzazione utente individuale in un nuovo contesto di database creato ma ApplicationDBContext non sta creando le tabelle AspNetUser nel mio nuovo database. Qualcuno può indicarmi la giusta direzione su questo?MVC 5 Non Auto Creazione tabelle AspNetUser nel DB
errore
The entity type ApplicationUser is not part of the model for the current context.
IdentityModel.cs
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("MyEntities", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
Web.config
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-MVC5.WebSite-20150723075149.mdf;Initial Catalog=aspnet-MVC5.WebSite-20150723075149;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="MyEntities" connectionString="metadata=res://*/Models.UserModel.csdl|res://*/Models.UserModel.ssdl|res://*/Models.UserModel.msl;provider=System.Data.SqlClient;provider connection string="data source=devserver;initial catalog=MyEntities;user id=user;password=pass;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
che conosco MVC è suppo sed per creare auto-magicamente il UserStore e le tabelle associate ma chiaramente ho fatto qualcosa di totalmente stupido qui. Ogni aiuto è molto apprezzato.
Hai provato a mettere alcuni dati su di esso? EF non crea DB finché non si inseriscono alcuni dati e si chiama il metodo 'SaveChanges()!'. –
non ci sono ancora dati .. – ExceptionLimeCat