Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What does Cascade in Nhibernate mean?

I see a lot of options in cascading:

  • Delete
  • All
  • AllDeleteOrphan
  • DeleteOrphan
  • SaveUpdate

Can you explain these with with examples and their distinctions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
472 views
Welcome To Ask or Share your Answers For Others

1 Answer

It means apply the action to an item's related items.

Please see: NHibernate Cascades: the different between all, all-delete-orphans and save-update:

  • none - do not do any cascades, let users handle them by themselves.

  • save-update - when the object is saved/updated, check the associations and save/update any object that requires it (including save/update the associations in many-to-many scenario).

  • delete - when the object is deleted, delete all the objects in the association.

  • delete-orphan - when the object is deleted, delete all the objects in the association. In addition, when an object is removed from the association and not associated with another object (orphaned), also delete it.

  • all - when an object is save/update/delete, check the associations and save/update/delete all the objects found.

  • all-delete-orphan - when an object is save/update/delete, check the associations and save/update/delete all the objects found. In additional to that, when an object is removed from the association and not associated with another object (orphaned), also delete it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...