You can set the cascade parameter to remove orphans:
HasMany(x => x.Children).KeyColumn("ParentId").AsBag().Inverse()
.Cascade.AllDeleteOrphan();
To do this, you need to remove the child from the parent collection and clear the session:
using (var txn = session.BeginTransaction())
{
parent.Children.Remove(child);
txn.Commit();
}
source
share