public bool ExecuteTransaction(List <BatchWrite> batchWrites) { using DynamoDBContext context = GetContext(); var multi = context.CreateMultiTableBatchWrite(batchWrites.ToArray()); var task = multi.ExecuteAsync(); task.Wait(); return(task.IsCompletedSuccessfully); }
public new async Task CreateAsync(Subscription subscription) { var EventAggregateBatch = DynamoDBContext.CreateBatchWrite <EventAggregate>(); var SubscriptionBatch = DynamoDBContext.CreateBatchWrite <Model.Subscription>(); subscription.Events.ForEach(e => { EventAggregateBatch.AddPutItem( new EventAggregate { SubscriptionId = subscription.Id, ApplicationId = subscription.ApplicationId, EventName = e.EventName } ); }); SubscriptionBatch.AddPutItem(subscription); MultiTableBatchWrite batch = DynamoDBContext.CreateMultiTableBatchWrite(EventAggregateBatch, SubscriptionBatch); await batch.ExecuteAsync(); }