【发布时间】:2014-02-27 01:43:58
【问题描述】:
我正在使用 ASPNet Identity 在我的 Web 应用程序中实现安全性。
有一个要求,我需要扩展 IdentityRole 和 IdentityUser。
这是我扩展 IdentityUser 的代码。
public class ApplicationUser : IdentityUser
{
public virtual User User { get; set; }
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("name=CoreContext")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>()
.ToTable("AspNetUsers");
modelBuilder.Entity<ApplicationUser>()
.ToTable("AspNetUsers");
}
}
我唯一的问题是身份角色
【问题讨论】:
-
而你的问题/问题是......究竟是什么?请更详细地更新您的问题。
-
我的问题是我无法扩展 IdentityRole。
-
@RamonCruz - 谁说你不能扩展 IdentityRole?
标签: asp.net-mvc-5 asp.net-identity