Correct Configuration for Deleting Related Entities

18 views
Skip to first unread message

ni...@customapp.co.za

unread,
Jan 8, 2014, 2:00:23 AM1/8/14
to sharp...@googlegroups.com
Say I got 3 Entities : Car, Damage, Picture.

A Car have a List of Damages.
A Damage have a Picture.

When I delete a car, it's damages get removed just fine, but the damage picture would still be in the database.

I assume it's just a Override I need to configure, but not sure the correct way.

Billy McCafferty

unread,
Jan 14, 2014, 2:36:44 PM1/14/14
to sharp...@googlegroups.com
What you're looking for is the cascade of all-delete-orphan.  The various cascade types are described at: http://ayende.com/blog/1890/nhibernate-cascades-the-different-between-all-all-delete-orphans-and-save-update

There are some great links here with respect to configuring NHibernate:  http://stackoverflow.com/questions/6348670/getting-started-with-nhibernate-3-2-loquacious-api - here's an example which includes a cascade:  http://notherdev.blogspot.com/2012/01/mapping-by-code-join.html

Hope this helps!

Billy McCafferty


--
You received this message because you are subscribed to the Google Groups "S#arp Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharp-lite+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages