Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }