public override void Cascade(ISessionImplementor session, object child, object anything) { log.Debug("cascading to delete()"); if (session.IsSaved(child)) { session.Delete(child); } }
private static void DeleteOrphans(PersistentCollection pc, ISessionImplementor session) { if (pc.WasInitialized) // can't be any orphans if it was not initialized { ICollection orphanColl = session.GetOrphans(pc); foreach (object obj in orphanColl) { session.Delete(obj); } } }
private static void DeleteOrphans(System.Type entityName, IPersistentCollection pc, ISessionImplementor session) { ICollection orphans; if (pc.WasInitialized) // can't be any orphans if it was not initialized { CollectionEntry ce = session.GetCollectionEntry(pc); orphans = ce == null ? CollectionHelper.EmptyCollection : ce.GetOrphans(entityName, pc); } else { orphans = CollectionHelper.EmptyCollection; } foreach (object orphan in orphans) { if (orphan != null) { session.Delete(orphan); } } }
private static void DeleteOrphans( PersistentCollection pc, ISessionImplementor session ) { if( pc.WasInitialized ) // can't be any orphans if it was not initialized { ICollection orphanColl = session.GetOrphans( pc ); foreach( object obj in orphanColl ) { session.Delete( obj ); } } }