With this class and mapping:
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();
}
}
The result is the following:
Table SomethingsToSimilarthings
-------------------------------
SomethingA_Id SomethingB_Id
111 222
222 111
Is there a way to define this mapping so that the bidirectional relation is expressed using only one database row?
source
share