public virtual void Delete(T cr) { if (cr == null) { return; } BeginDeleteCallback?.Invoke(cr); lock (globalDBLock) { lock (Cache) { using (var session = DatabaseFactory.SessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); Cache.Remove(cr); session.Delete(cr); transaction.Commit(); } } } } EndDeleteCallback?.Invoke(cr); }
public virtual void Delete(IReadOnlyCollection <T> objs) { if (objs.Count == 0) { return; } foreach (T cr in objs) { BeginDeleteCallback?.Invoke(cr); } using (var session = DatabaseFactory.SessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { foreach (T cr in objs) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); Cache.Remove(cr); session.Delete(cr); } transaction.Commit(); } } foreach (T cr in objs) { EndDeleteCallback?.Invoke(cr); } }
public virtual void Delete(List <T> objs) { if (objs.Count == 0) { return; } foreach (T obj in objs) { BeginDeleteCallback?.Invoke(obj); } using (var session = JMMService.SessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { foreach (T cr in objs) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); session.Delete(cr); } transaction.Commit(); } } foreach (T obj in objs) { EndDeleteCallback?.Invoke(obj); } }
//This function do not run the BeginDeleteCallback and the EndDeleteCallback public virtual void DeleteWithOpenTransaction(ISession session, T cr) { if (cr != null) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); Cache.Remove(cr); session.Delete(cr); } }
//This function do not run the BeginDeleteCallback and the EndDeleteCallback public virtual void DeleteWithOpenTransaction(ISession session, List <T> objs) { if (objs.Count == 0) { return; } foreach (T cr in objs) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); session.Delete(cr); } }
//This function do not run the BeginDeleteCallback and the EndDeleteCallback public virtual void DeleteWithOpenTransaction(ISession session, T cr) { if (cr == null) { return; } lock (globalDBLock) { lock (Cache) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); Cache.Remove(cr); session.Delete(cr); } } }
public virtual void Delete(T cr) { if (cr != null) { BeginDeleteCallback?.Invoke(cr); using (var session = DatabaseFactory.SessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); session.Delete(cr); transaction.Commit(); } } EndDeleteCallback?.Invoke(cr); } }
//This function do not run the BeginDeleteCallback and the EndDeleteCallback public void DeleteWithOpenTransaction(ISession session, List <T> objs) { if (objs.Count == 0) { return; } lock (globalDBLock) { foreach (T cr in objs) { lock (cr) { DeleteWithOpenTransactionCallback?.Invoke(session, cr); session.Delete(cr); } } } }