Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate Mapping By Code Cascade All-Delete-Orphans

How to set cascade to all-delete-orphans with mapping by code in NHibernate?

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

How can I combine All & DeleteOrphans?

like image 603
samvdst Avatar asked Jan 08 '23 22:01

samvdst


1 Answers

Try to use:

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

Because the Cascade is a [Flag] ... multi could be used:

What does the [Flags] Enum Attribute mean in C#?
like image 106
Radim Köhler Avatar answered Jan 17 '23 21:01

Radim Köhler