entity framework - Cannot Find ASP.NET Identity Tables in Database -
i created database using using ef code-first migrations approach. when ran application registered user , expected identity tables added database created couldn't find tables. checked connection string sure rightly set. please have missed out? please help.
edit: code context.
public class appdatacontext : dbcontext { public appdatacontext() : base("appconnection") { } public dbset<appuser> appusers { get; set; } public dbset<attendance> attendances { get; set; } public dbset<classinfo> classes { get; set; } public dbset<enrollment> enrollments { get; set; } public dbset<messageboard> messageboards { get; set; } public dbset<notification> notifications { get; set; } public dbset<notification_user> usernotifications { get; set; } public dbset<notificationtype> notificationtypes { get; set; } public dbset<parent> parents { get; set; } public dbset<parentsubscription> parentsubscriptions { get; set; } public dbset<privatemessage> privatemessages { get; set; } public dbset<school> schools { get; set; } public dbset<sessionperiod> sessionperiods { get; set; } public dbset<setting> settings { get; set; } public dbset<student> students { get; set; } public dbset<subject> subjects { get; set; } public dbset<teacher> teachers { get; set; } public dbset<teacherschool> teacherschools { get; set; } public dbset<term> terms { get; set; } public dbset<work> works { get; set; } public dbset<worktype> worktypes { get; set; } #region override methods protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.conventions.remove<pluralizingtablenameconvention>(); modelbuilder.entity<subject>() .hasmany(c => c.teachers).withmany(i => i.subjects) .map(t => t.mapleftkey("subjectid") .maprightkey("teacherid") .totable("subjectteacher")); modelbuilder.entity<classinfo>() .hasmany(s => s.subjects).withmany(c => c.classes) .map(u => u.mapleftkey("classinfoid").maprightkey("subjectid").totable("classsubject")); //modelbuilder.entity<department>().maptostoredprocedures(); modelbuilder.conventions.remove<onetomanycascadedeleteconvention>(); //modelbuilder.entity<classinfo>() // .property(f => f.dateadded) // .hascolumntype("datetime2"); } #endregion }
when registered user :
- refresh project
- show files
you find:
edit:
identitymodels.cs:
public class applicationdbcontext : identitydbcontext<applicationuser> { public applicationdbcontext() //: base("defaultconnection", throwifv1schema: false) : base("appconnection", throwifv1schema: false) { } public static applicationdbcontext create() { return new applicationdbcontext(); } } public class appdatacontext : dbcontext { public appdatacontext() : base("appconnection") { } }
web.config:
<connectionstrings> <add name="appconnection" connectionstring="data source=.; initial catalog=sis_db;integrated security=sspi;" providername="system.data.sqlclient" /> </connectionstrings>
Comments
Post a Comment