我有这个实体:
public class User
{
public int Id {get;set;}
public List<int> Permissions {get;set;}
}
作为一对多关系,我该怎么做才能完成这项工作?
答案 0 :(得分:1)
创建Permission
类型:
public class User
{
public int Id { get; set; }
public ICollection<Permission> Permissions { get; set; }
}
public class Permission
{
public int Id { get; set; }
public int Value { get; set; }
}