/// <summary> /// 提交事务 /// </summary> /// <returns></returns> public int Commit() { int res = -1; this.Logger(this.GetType(), "提交事务-Commit", () => { if (this.BaseDbTransaction != null) { this.BaseDbTransaction.Commit(); this.Close(); } res = 1; }, e => { if (e.InnerException != null && e is CustomException) { SqlException sqlEx = e.InnerException.InnerException as SqlException; if (sqlEx != null) { string msg = DataAccessExMessage.GetSqlExceptionMessage(sqlEx.Number); throw CustomException.ThrowDataAccessException(sqlEx, msg); } } else { throw new Exception("提交事务发生异常-Commit", e.InnerException); } }, () => { if (this.BaseDbTransaction == null) { this.Close(); } }); return(res); }