asp.net mvc 5 - Scaffolding ApplicationUser -
i'm using default template asp.net mvc 5 ef 6. generates identity model as
public class applicationuser : identityuser { public async task<claimsidentity> generateuseridentityasync(usermanager<applicationuser> manager) { // note authenticationtype must match 1 defined in cookieauthenticationoptions.authenticationtype var useridentity = await manager.createidentityasync(this, defaultauthenticationtypes.applicationcookie); // add together custom user claims here homecoming useridentity; } } public class applicationdbcontext : identitydbcontext<applicationuser> { public applicationdbcontext() : base("defaultconnection", throwifv1schema: false) { } public static applicationdbcontext create() { homecoming new applicationdbcontext(); } }
i able manage , edit list of users, scaffolded identity model , added next line in applicationdbcontext class.
public system.data.entity.dbset<qproj.models.applicationuser> applicationusers { get; set; }
i know wrong, i'm not sure how resolve this.
these steps made me scaffolding applicationuser:
refactor applicationuser name else, myappuser, add controller entityframework, using model myappuser, scaffolding myappuser, the scaffolding create propertydbset<myappuser> myappusers
applicationdbcontext, delete it in newly created controller, alter occurence of db.myappusers
to db.users
then you're go, hope helps
asp.net-mvc-5 entity-framework-6
No comments:
Post a Comment