0
我使用Asp.net身份。我想添加一些额外的列到表AspnetUserLogins(列Firstname,姓氏)。为了我继承IdentityUserLogins
类像Asp.net身份,继承IdentityUserLogins类
public class ApplicationUserLogin : IdentityUserLogin
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
在实际应用中我使用功能通过的UserManager类,这种方式的外部登录添加到某些用户:
ExternalLoginInfo eInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo();
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
IdentityResult result = manager.AddLogin(this.User.Identity.GetUserId(), eInfo.Login);`
,一切工作正常。此代码向AspnetUserLogins
表添加新记录,并且不幸插入"IdentityUserLogin"
值到Discriminator
列。是否有posibility怎么说UserManager<ApplicationUser>
类中使用子类ApplicationUserLogin
代替IdentityUserLogin
(与"ApplicationUserLogin"
填入值鉴别列?