当我尝试将新对象添加到导航集合导航属性时,我收到此错误可能未设置。
这是我的 POCO:
public class Category : BaseEntity,IDeletable
{
public Category()
{
Products = new List<Product>();
ChildCategories = new List<Category>();
}
[Required]
[Display(ResourceType = typeof(DelkaShop.Entities.EntityText.EntityText), Name = "EntityName")]
public String Name { get; set; }
[Display(ResourceType = typeof(DelkaShop.Entities.EntityText.EntityText), Name = "ParentCategory")]
public int? ParentCategoryId { get; set; }
[Display(ResourceType = typeof(DelkaShop.Entities.EntityText.EntityText), Name = "ItemsPerPage")]
public int? ItemsPerPage { get; set; }
[InverseProperty("Categories")]
public ICollection<Product> Products { get; set; }
[ForeignKey("ParentCategoryId")]
[Display(ResourceType = typeof(DelkaShop.Entities.EntityText.EntityText), Name = "ParentCategory")]
public Category ParentCategory { get; set; }
public ICollection<Category> ChildCategories { get; set; }
}
在微风中,我正在做类似 product.Categories.push(newCategoryObject);
有人可以指出我正确的方向吗?
编辑:我忘了提到我在多对多关系中遇到了这个错误,只是在文档中读到这还不支持。
有没有解决方法?