My domain object Page has properies
public class Page
{
public virtual string Title {get; set;}
public virtual Page Parent {get; set;}
public virtual IList<Page> ChildPages {get; set;}
}
I was thinking to map object to the db like this
Bag(x => x.ChildPages,
b =>
{
b.Inverse(true);
b.Cascade(Cascade.DeleteOrphans);
},
r => { r.OneToMany(); }
);
ManyToOne(x => x.ParentPage, m =>
{
m.Cascade(Cascade.All);
}
);
To make it clearer please look this from this perspective Page is page object in context of web page. That page can have 0 or many child pages and one page can belong to 0 or 1 parent page.
So is this mapping ok, I'm especially anxious about cascade and inverse attributes.
Thanks