【发布时间】:2016-11-21 03:21:13
【问题描述】:
如何在 Identity 3.0 中的 AspNetRoles 和我的自定义表之间建立多对多关系?我想要简单的 3 表,同时具有 PermissionId 和 RoleId,例如 AspNetUsersRole。我有这样的事情:
public class Permission
{
public int PermissionId { get; set; }
public string Name { get; set; }
public virtual ICollection<ApplicationRole> Roles { get; set; }
}
public class ApplicationRole : IdentityRole
{
public virtual ICollection<Permission> Permissions { get; set; }
}
但是当我想添加迁移时,我得到了错误:
Unable to determine the relationship represented by navigation property 'ApplicationRole.Permissions' of type 'ICollection<Permission>'. Either manually configure the relationship, or ignore this property from the model.
【问题讨论】:
标签: asp.net asp.net-mvc entity-framework asp.net-identity