Hi,
I want a bidirectional mapping in one class, in which the child can choose its parent (and save it to the database).
How would I model that?
This is what I have:
public class MyNodeMap : ClassMap<MyNode>
{
public MyNodeMap ()
{
Table("myTreeTable");
Id(x => x.Id).Column("NotParentId").GeneratedBy.Identity();
References(x => x.Parent).Column("ParentId");
HasMany(x => x.Children).KeyColumn("ParentId").Inverse();
}
}
But it does not work.
When I change the Parent-Property of a MyNode object and call Session.SaveOrUpdate, it does not persist the modified ParentId to the database.
Thanks to anyone reading this post.