我已经按照
http://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity中的描述更改了PK,但是在我尝试登录后,我收到以下错误.登录部分成功,因为“this”包含所有相关数据,但创建身份似乎失败
从物化的“System.String”类型到“system.int32”类型的指定强制转换无效.
在线
var userIdentity = await manager.CreateIdentityAsync(this,DefaultAuthenticationTypes.ApplicationCookie);
public class ApplicationUser : IdentityUser<int,CustomUserLogin,CustomUserRole,CustomUserClaim> { public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser,int> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationoptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this,DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return userIdentity; } public string FirstName { get; set; } public string LastName { get; set; } }