流暢な NHibernate: Product to Product との多対多の関係。asp.net mvc で実装する方法
public class Product
{
public virtual int Id { get; set; }
public virtual IList<Product> ManyProduct { get; set; }
}
マッピング
public class ProductMap : ClassMap<Product>
{
public ProductMap()
{
Id(x => x.Id);
Map(x => x.ImageUrl);
}
HasManyToMany(x => x.ManyProduct)
.Cascade.All()
.Table("ProductInProduct");
}