コード例 #1
0
        public virtual int Insert(Type type, ICollection items)
        {
            ErrorIfClosed();
            if (items.Count == 0)
            {
                return(0);
            }
            int result = 0;

            try
            {
                InternalOpen();
                SqlTable table = TableFor(type);
                if (autocommit)
                {
                    BeginInternal();
                }
                result = table.Insert(this, items);
                if (autocommit)
                {
                    CommitInternal();
                }
            }
            catch (Exception)
            {
                if (autocommit)
                {
                    RollbackInternal();
                }
                throw;
            }
            finally
            {
                InternalClose();
            }
            return(result);
        }