NHibernate的级联级联、NHibernate

2023-09-02 20:49:00 作者:别搅

这是什么 级联的在 NHibernate的是什么意思?

What does Cascade in Nhibernate mean?

我看到很多选项级联:

删除 所有 AllDeleteOrphan DeleteOrphan SaveUpdate

你能与实例和他们的区别解释这些?

Can you explain these with with examples and their distinctions?

推荐答案

这意味着应用行动项目的相关项目。

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

请参见: NHibernate的瀑布:所有的不同,全删除,孤儿和保存更新:

  

无 - 不做任何瀑布,让   用户自行处理。

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.