Exemplo n.º 1
0
        /// <summary>
        /// 开始一个事务,默认是在关闭连接的时候,自动提交事务
        /// </summary>
        /// <param name="autoCommitOnDispose"></param>
        /// <returns></returns>
        public virtual DataContextTransaction BeginTransaction(bool autoCommitOnDispose = true)
        {
            var dct = new DataContextTransaction(this);

            dct.BeginTransaction();

            return(dct);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 指定事务级别,开始一个事务
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        public virtual DataContextTransaction BeginTransaction(IsolationLevel level)
        {
            var dct = new DataContextTransaction(this);

            dct.BeginTransaction(level);

            return(dct);
        }