public virtual int Delete(Type type, IQuery query) { ErrorIfClosed(); int result = 0; try { InternalOpen(); LitTable table = TableFor(type); if (autocommit) { BeginInternal(); } result = table.Delete(this, query); if (autocommit) { CommitInternal(); } } catch (Exception) { if (autocommit) { RollbackInternal(); } throw; } finally { InternalClose(); } return(result); }
public virtual int Delete(Type type, ICollection items) { ErrorIfClosed(); if (items.Count == 0) { return(0); } int result = 0; try { InternalOpen(); LitTable table = TableFor(type); if (autocommit) { BeginInternal(); } result = table.Delete(this, items); if (autocommit) { CommitInternal(); } } catch (Exception) { if (autocommit) { RollbackInternal(); } throw; } finally { InternalClose(); } return(result); }