3
有了這個類和映射:功能NHibernate:自我指涉多對多
Public class Something
{
public int Id;
public IList<Something> Similarthings { get; set; }
}
public class SomtehingMapping
{
public SomtehingMapping()
{
Map(x => x.Id);
HasManyToMany(x => x.Similarthings)
.Table("SomethingsToSimilarthings")
.ParentKeyColumn("SomethingA_Id")
.ChildKeyColumn("SomethingB_Id")
.Cascade.All();
}
}
你這樣結束了:
Table SomethingsToSimilarthings
-------------------------------
SomethingA_Id SomethingB_Id
111 222
222 111
有沒有定義這個映射,使任何方式的雙向關係只用一個數據庫行來表示?
你解決這個問題? – alexn 2010-12-20 14:41:49