Exemple #1
0
        public virtual async Task SaveChangesAsync(CancellationToken cancellationToken = default)
        {
            CheckSaved();

            List <Exception> exceptions = new List <Exception>();

            foreach (var @transaction in CreatedTransactions)
            {
                try
                {
                    await @transaction.CommitAsync(cancellationToken);
                }
                catch (Exception ex)
                {
                    ErrorTransactions.Add(@transaction);
                    exceptions.Add(ex);
                }
            }

            if (exceptions.Count > 0)
            {
                ReThrow(exceptions);
            }

            Events?.Completed(this);
        }
Exemple #2
0
        public virtual void SaveChanges()
        {
            CheckSaved();

            List <Exception> exceptions = new List <Exception>();

            foreach (var @transaction in CreatedTransactions)
            {
                try
                {
                    @transaction.Commit();
                }
                catch (Exception ex)
                {
                    ErrorTransactions.Add(@transaction);
                    exceptions.Add(ex);
                }
            }

            if (exceptions.Count > 0)
            {
                ReThrow(exceptions);
            }

            Events?.Completed(this);
        }