public class Node
{
public virtual int Id {get; set;}
public virtual string Name {get; set;}
public virtual IList<Node> Ancestors {get; set;}
public virtual IList<Node> Descendants {get; set;}
}
如何为这种情况设置映射约定?
谢谢
答案 0 :(得分:0)
您确定要参加会议吗?我猜你只想要一个流畅的映射。这是我上次帮助某人的一个例子:
public class CustomerMap : ClassMap<Customer>
{
public CustomerMap()
{
Id(x => x.CustomerId);
Map(x => x.Birthday);
Map(x => x.FirstName);
HasManyToMany(x => x.Parents)
.ParentKeyColumn("ChildID")
.ChildKeyColumn("ParentID")
.Inverse();
HasManyToMany(x => x.Children)
.ParentKeyColumn("ParentID")
.ChildKeyColumn("ChildID");
}
}