protected internal async Task <bool> CommitAsync()
        {
            if (NotificationsHandler?.HasEvents() == true)
            {
                return(false);
            }

            if (CanCommit?.Invoke() == true)
            {
                await UnitOfWork.CommitAsync();

                return(true);
            }

            return(false);
        }
Exemple #2
0
 /// <summary>
 /// 提交事务
 /// </summary>
 public void Commit()
 {
     //分布式事务,二阶段提交,或三阶段提交
     //暂不支持
     try
     {
         DisposeTimer();
         CanCommit?.Invoke();
         PreCommit?.Invoke();
         _DoCommit?.Invoke();
     }
     finally
     {
         CanCommit = null;
         PreCommit = null;
         _DoCommit = null;
     }
 }