private static CascadeOn Cleanup(CascadeOn cascade) { bool hasAll = cascade.Has(CascadeOn.All) || cascade.Has(AnyButOrphans); if (hasAll && cascade.Has(CascadeOn.DeleteOrphans)) { return(CascadeOn.All | CascadeOn.DeleteOrphans); } if (hasAll) { return(CascadeOn.All); } return(cascade); }
public static CascadeOn Exclude(this CascadeOn source, CascadeOn value) { if (source.Has(CascadeOn.All) && !value.Has(CascadeOn.All)) { return(Cleanup(((source & ~CascadeOn.All) | AnyButOrphans) & ~value)); } return(Cleanup(source & ~value)); }
private static Cascade IncludeIfNeeded(CascadeOn source, CascadeOn valueToCheck, Cascade destination) { return(source.Has(valueToCheck) ? destination.Include(ConvertSingleValue(valueToCheck)) : destination); }