Ejemplo n.º 1
0
        public async Task CommitAsync()
        {
            if (!IsWorkBegun)
            {
                throw new InvalidOperationException($"This {this} has not been started yet");
            }

            foreach (var listener in unitOfWorkListeners.Value)
            {
                await listener.OnBeforeWorkCommitAsync(this);
            }

            foreach (ITransaction transaction in innerTransactions)
            {
                await transaction.CommitAsync();
            }

            await EventBuffer.FlushAsync(new CancellationToken());

            foreach (var listener in unitOfWorkListeners.Value)
            {
                await listener.OnWorkSucceededAsync(this);
            }
        }