通过代码级联的 NHibernate 映射全部删除孤儿

NHibernate Mapping By Code Cascade All-Delete-Orphans

如何在 NHibernate 中通过代码映射将级联设置为 all-delete-orphans?

[Flags]
public enum Cascade
{
    None = 0,
    Persist = 2,
    Refresh = 4,
    Merge = 8,
    Remove = 16,
    Detach = 32,
    ReAttach = 64,
    DeleteOrphans = 128,
    All = 256,
}

如何合并 All 和 DeleteOrphans?

尝试使用:

r.Cascade(Cascade.All | Cascade.DeleteOrphans);

因为 Cascade 是一个 [Flag] ... multi 可以使用:

What does the [Flags] Enum Attribute mean in C#?