Defines the cascading behaviour of this association.

Namespace: Castle.ActiveRecord
Assembly:  Castle.ActiveRecord (in Castle.ActiveRecord.dll)
Version: 1.0.3.0

Syntax

C#
[SerializableAttribute]
public enum ManyRelationCascadeEnum

Members

Member nameDescription
None
No cascading. This is the default. The cascade should be handled manually.
All
Cascade save, update and delete. When the object is saved, updated or deleted, the associations will be checked and the objects found will also be saved, updated or deleted.
SaveUpdate
Cascade save and update. When the object is saved or updated, the associations will be checked and any object that requires will be saved or updated (including saving or updating the associations in many-to-many scenario).
Delete
Cascade delete. When the object is deleted, all the objects in the association will be deleted as well.
AllDeleteOrphan
Cascade save, update and delete, removing orphan children. When an object is saved, updated or deleted, the associations will be checked and all objects found will be saved, updated or deleted as well. In additional to that, when an object is removed from the association and not associated with another object (orphaned), it will also be deleted.

Remarks

Entities has associations to other objects, this may be an association to a single item (BelongsToAttribute) or an association to a collection (HasManyAttribute, HasManyToAnyAttribute). At any rate, you are able to tell NHibernate to automatically traverse an entity's associations, and act according to the cascade option. For instance, adding an unsaved entity to a collection with SaveUpdate cascade will cause it to be saved along with its parent object, without any need for explicit instructions on our side.

See Also