/// <summary>
        /// 手工创建事务提交
        /// </summary>
        /// <param name="transactionActionManager">事务操作管理器</param>
        /// <param name="cancellationToken">取消令牌</param>
        private async Task <int> TransactionCommit(ITransactionActionManager transactionActionManager,
                                                   CancellationToken cancellationToken)
        {
            using (var connection = Database.GetDbConnection())
            {
                if (connection.State == ConnectionState.Closed)
                {
                    await connection.OpenAsync(cancellationToken);
                }
                var publisher = ServiceProvider.GetService <ICapPublisher>();
                using (var capTransaction = Database.BeginTransaction(publisher, autoCommit: false))
                {
                    try
                    {
                        await transactionActionManager.CommitAsync(
                            publisher.Transaction.Value.DbTransaction as IDbTransaction);

                        var result = await base.SaveChangesAsync(cancellationToken);

                        capTransaction.Commit();
                        return(result);
                    }
                    catch (Exception e)
                    {
                        capTransaction.Rollback();
                        throw;
                    }
                }
            }
        }
        /// <summary>
        /// 手工创建事务提交
        /// </summary>
        /// <param name="transactionActionManager">事务操作管理器</param>
        /// <param name="cancellationToken">取消令牌</param>
        private async Task <int> TransactionCommit(ITransactionActionManager transactionActionManager,
                                                   CancellationToken cancellationToken)
        {
            using (var connection = Database.GetDbConnection())
            {
                if (connection.State == ConnectionState.Closed)
                {
                    await connection.OpenAsync(cancellationToken);
                }
                using (var transaction = connection.BeginTransaction())
                {
                    try
                    {
                        await transactionActionManager.CommitAsync(transaction);

                        Database.UseTransaction(transaction);
                        var result = await base.SaveChangesAsync(cancellationToken);

                        transaction.Commit();
                        return(result);
                    }
                    catch (Exception e)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
        }
        /// <summary>
        /// 手工创建事务提交
        /// </summary>
        /// <param name="transactionActionManager">事务操作管理器</param>
        /// <param name="cancellationToken">取消令牌</param>
        private async Task <int> TransactionCommit(ITransactionActionManager transactionActionManager, CancellationToken cancellationToken)
        {
            var publisher      = LazyServiceProvider.LazyGetService <ICapPublisher>();
            var capTransaction = UnitOfWork.BeginTransaction(publisher, autoCommit: false);
            await transactionActionManager.CommitAsync(
                publisher.Transaction.Value.DbTransaction as IDbTransaction);

            var result = await base.SaveChangesAsync(cancellationToken);

            UnitOfWork.Commit(capTransaction);
            return(result);
            //try
            //{
            //    await transactionActionManager.CommitAsync(
            //        publisher.Transaction.Value.DbTransaction as IDbTransaction);
            //    var result = await base.SaveChangesAsync(cancellationToken);
            //    await capTransaction.CommitAsync(cancellationToken);
            //    return result;
            //}
            //catch (Exception e)
            //{
            //    await capTransaction.RollbackAsync(cancellationToken);
            //    throw;
            //}
        }