域类中的子对象

| 我有一个像
public class Category
{
    [Key]
    public string IdCategory { get; set; }
    public string Name { get; set; }
    public List<Category> Children { get; set; }
    public List<Product> Products { get; set; }



    public Category()
    {
        Products = new List<Product>();
        Children = new List<Category>();
    }

}
在生成的代码中,我找到了产品集合,但找不到子集合。使用同一类有一些限制吗?还有另一种方法可以对此关系建模而无需重复使用键?     
已邀请:
        
public  class Category
    {
        [Key]
        public string IdCategory { get; set; }
        public string Name { get; set; }
        public string IdFather { get; set; }
        public List<Product> Products { get; set; }
        [Include]            
        [Association(\"ParentChild\", \"IdCategory\", \"IdFather\")]
        public List<Category> Children { get; set; }




        public Category()
        {
            Products = new List<Product>();
            Children = new List<Category>();

        }
    }
    

要回复问题请先登录注册