-
Notifications
You must be signed in to change notification settings - Fork 873
Description
Describe the bug
DynamoDB has undergone a lot of changes in the version 4 of the SDK, including separating the shared DynamoDBOperationConfig into new operation-specific objects (SaveConfig, LoadConfig, QueryConfig, etc.). See: #3421
The method IDynamoDBContext.CreateTransactWrite<T>(DynamoDBOperationConfig) is now marked as obsolete, and the suggested replacement is IDynamoDBContext.CreateTransactWrite<T>(TransactWriteConfig).
The new TransactWriteConfig doesn't have property SkipVersionCheck that the generic config class has, forcing it to have the default value false. This can cause conditional checks to fail when executing the transaction.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Creating a transact write with disabled version check should be possible:
var updateTransaction = dbContext.CreateTransactWrite<Entity>(new TransactWriteConfig
{
SkipVersionCheck = true
});Current Behavior
The SkipVersionCheck property is not available:
var transaction = dbContext.CreateTransactWrite<Entity>(new TransactWriteConfig
{
SkipVersionCheck = true // <-- Error
});Using the obsolete method works:
var transaction = dbContext.CreateTransactWrite<Entity>(new DynamoDBOperationConfig
{
SkipVersionCheck = true
}); // <-- Warning method obsolete
transaction.AddSaveItem(entity);
await transaction.ExecuteAsync(ct); // <-- WorksReproduction Steps
var transaction = dbContext.CreateTransactWrite<Entity>();
transaction.AddSaveItem(entity); // <-- Item with wrong version
await transaction.ExecuteAsync(ct); // <-- Throws TransactionCanceledException with reason ConditionalCheckFailedPossible Solution
Add the property SkipVersionCheck to the TransactWriteConfig class, and map it to the property with the same name in the method TransactWriteConfig.ToDynamoDBOperationConfig().
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.DynamoDBv2 4.0.10.4
Targeted .NET Platform
.NET Core 8
Operating System and version
Windows 11, AWS Lambda