Cascading items in a collection of a component
Posted
by mattcole
on Stack Overflow
See other posts from Stack Overflow
or by mattcole
Published on 2010-05-18T21:30:07Z
Indexed on
2010/05/18
22:20 UTC
Read the original article
Hit count: 179
I have a component which contains a collection. I can't seem to get NHibernate to persist items in the collection if I have the collection marked as Inverse. They will persist if I don't have Inverse on the collection, but I get an insert and then an update statement.
My mapping is :
m => m.Component(x => x.Configuration, c =>
{
c.HasMany(x => x.ObjectiveTitleTemplates)
.Access.ReadOnlyPropertyThroughCamelCaseField(Prefix.Underscore)
.AsSet()
//.Inverse()
.KeyColumns.Add("ObjectiveProcessInstanceId")
.Cascade.AllDeleteOrphan();
});
Is there a way to get it working marking the collection as Inverse and therefore avoiding the extra insert?
Thanks!
© Stack Overflow or respective owner