Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Transaction for DynamoDB using Document Interfaces or Object Persistence Interface #1471

Closed
hanslai opened this issue Dec 1, 2019 · 3 comments
Labels
duplicate This issue is a duplicate.

Comments

@hanslai
Copy link

hanslai commented Dec 1, 2019

#25 has been 6 years.
There are really little document on .net or .net core.
And seems impossible to do it in Document Interfaces or Object Persistence Interface.

@klaytaybai
Copy link
Contributor

Thanks for voicing your interest. I'm going to close this out as a duplicate of #1453. If you have any more comments to add about your use case or how you would prefer the implementation to look like, please comment there.

@klaytaybai klaytaybai added the duplicate This issue is a duplicate. label Dec 2, 2019
@dtabuenc
Copy link

How hard can this possibly be? Transaction support is already in the low level library, I would assume the high level libraries are just handling type serialization and such... so how hard is it to add the transactional version of the batching methods?

@dtabuenc
Copy link

dtabuenc commented Apr 22, 2022

For anyone looking for a workaround, you can combine the low-level api with high-level api serialization by doing something like:

    var dynamoDbClient = new AmazonDynamoDBClient();
    var dynamoDbContext = new DynamoDBContext(dynamoDbClient);
    var item1 = new MySampleItem();
    var item2 = new MySampleItem();
    await dynamoDbClient.TransactWriteItemsAsync(new TransactWriteItemsRequest()
    {
      TransactItems = new List<TransactWriteItem>
      {
        new TransactWriteItem()
        {
          Put = new Put()
          {
            Item = dynamoDbContext.ToDocument(item1).ToAttributeMap(),
            TableName = dynamoDbContext.GetTargetTable<MySampleItem>().TableName
          },
        },
        new TransactWriteItem()
        {
          Put = new Put()
          {
            Item = dynamoDbContext.ToDocument(item2).ToAttributeMap(),
            TableName = dynamoDbContext.GetTargetTable<MySampleItem>().TableName
          }
        },
      }
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants