保存列表<int> </int>

时间:2012-11-22 17:04:51

标签: c# entity-framework

我有这个实体:

public class User
{
     public int Id {get;set;}
     public List<int> Permissions {get;set;}
}

作为一对多关系,我该怎么做才能完成这项工作?

1 个答案:

答案 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; }
}