0
我首先使用实体框架代码。 我有两个非常类似的虚拟ICollection属性类。 这里是集合类其中之一:如何从虚拟ICollection中返回EnityCollection?
public class Name
{
public int Id{ get; set;}
[MaxLength(64)]
[Index(IsUnique = true)]
[Required]
public string Value { get; set; }
public virtual ICollection<NameVariant> Variants { get; set; }
}
public class NameVariant
{
public int Id{ get; set;}
[MaxLength(64)]
[Index(IsUnique = true)]
[Required]
public string Value { get; set; }
public int ParentId { get; set; }
public virtual Name Parent { get; set; }
}
我在另外一个案例和HashSet的获得EntityCollection的变体。 它取决于什么?我如何从这两个类获得EnityCollection?