2
가 준수와 함께 :매핑 NHibernate에 내가 (간결하게 요약) 2 개 클래스를
public class Product : Entity<Guid>
{
...
public virtual IList<Ingredient> Ingredients { get; set; }
public Product(){Ingredients = new List<Ingredient>();}
}
및
public partial class Ingredient : Entity<int>
{
...
public virtual IList<Product> Products { get; set; }
public Ingredient(){Products = new List<Product>();}
}
그들은이 ManyToMany 관계를 가지고 있고, 내가하고 싶은 :
- 성분 하나를 지우면 제품이 제거되지 않고 성분 목록에 들어 있습니다.
- 하나의 제품을 삭제하면 성분이 모두 삭제되지 않습니다.
이지도를 만들었지 만 작동하지 않습니다.
orm.ManyToMany<Product, Ingredient>();
orm.Cascade<Product, Ingredient>(CascadeOn.DeleteOrphans);