1
我有這段代碼來定義我的ApplicaitonUser。名稱和創建是我添加的自定義字段。向MVC SimpleMembership角色添加自定義字段
如何爲角色做同樣的事情?我需要爲它們添加一個整數字段。
public class ApplicationUser : IdentityUser
{
public DateTime Created { get; set; }
public string Name { get; set; }
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> 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 ApplicationUser()
{
Created = DateTime.UtcNow;
}
}