entity framework - ASP.NET MVC domain Models and Identity Models in same context - UserLogin has no key -


i want application models in same dbcontext has identity model. inserted classes identitydbcontext this:

public partial class applicationdbcontext : identitydbcontext<applicationuser>     {         public applicationdbcontext() : base("humantask")         {         }          public virtual dbset<wfinstance> wfinstance { get; set; }         public virtual dbset<wfservice> wfservice { get; set; }         public virtual dbset<wftask> wftask { get; set; }         public virtual dbset<wfworkflow> wfworkflow { get; set; }          protected override void onmodelcreating(dbmodelbuilder modelbuilder)         {             modelbuilder.entity<wftask>()                 .property(e => e.wftaskid)                 .isunicode(false);              modelbuilder.entity<wfworkflow>()                 .property(e => e.name)                 .isunicode(false);         }     } 

}

now, when try create new controller 1 of classes classes using scaffold

i message this:

i think i'm missing on onmodelcreating function, cant tell what. ?

from error looks missing key attributes identityuserlogin , identityuser role models. need specify key on model this:

public partial class identityuserlogin {     [key]     public string username { get; set; } } 

or can specify fluent api

modelbuilder.entity<identityuserlogin>()      .haskey(t => t.username);  

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -