c# - Using ASP.NET Identity 2.2.1 with my own table in MVC -
i installed identity 2.2.1 today. created own classes role, user, claim, usermanager, userrole, emailservice , smsservice. above classes seem working.
i added new class called signinmanager. can't seem fix error message. i'm getting convert error message.
public class mysigninmanager : signinmanager<myuser, long> { public mysigninmanager(myusermanager usermanager, iauthenticationmanager authenticationmanager) : base(usermanager, authenticationmanager) { }
cannot implicitly convert type 'system.threading.tasks.task' 'system.threading.tasks.task'
public override task<myclaim> createuseridentityasync(myuser user) { return user.generateuseridentityasync((myusermanager)usermanager); }
this method okay
public static mysigninmanager create(identityfactoryoptions<mysigninmanager> options, iowincontext context) { return new mysigninmanager(context.getusermanager<myusermanager>(), context.authentication); }
the user class looks this:
public class myuser : identityuser<long, mylogin, myuserrole, myclaim> { public string activationtoken { get; set; } public string passwordanswer { get; set; } public string passwordquestion { get; set; } public async task<claimsidentity> generateuseridentityasync(myusermanager usermanager) { var useridentity = await usermanager.createidentityasync(this, defaultauthenticationtypes.applicationcookie); // add custom user claims here return useridentity; } }
the method ends in async
, indication need use async semantics:
public async override task<myclaim> createuseridentityasync(myuser user) { return await user.generateuseridentityasync((myusermanager)usermanager); }
i.e. add async
method signature , await
result
Comments
Post a Comment