public void Start() { if (_uoWState == UoWState.Started) { throw new OngoingTransactionException(); } _operations = new TransactWriteItem[Constants.MaximumTransactionOperations]; _uoWState = UoWState.Started; _trackedOperations = 0; }
public async Task <TransactWriteItemsResponse> Commit(string clientRequestToken, CancellationToken cancellationToken = default) { if (_uoWState != UoWState.Started) { throw new UnitOfWorkNotStartedException(); } var request = new TransactWriteItemsRequest { TransactItems = _operations.ToList(), ClientRequestToken = clientRequestToken }; _uoWState = UoWState.Committed; return(await _client.TransactWriteItemsAsync(request, cancellationToken).ConfigureAwait(false)); }
public DynamoDBUnitOfWork(IAmazonDynamoDB client) { _uoWState = UoWState.New; _client = client; }