AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Marks a property or field as an atomic counter in DynamoDB. This attribute indicates that the associated property or field should be treated as an atomic counter, which can be incremented or decremented directly in DynamoDB during update operations. It is useful for scenarios where you need to maintain a counter that is updated concurrently by multiple clients without conflicts. The attribute also allows specifying an alternate attribute name in DynamoDB using the `AttributeName` property, as well as configuring the increment or decrement value (`Delta`) and the starting value (`StartValue`).
Namespace: Amazon.DynamoDBv2.DataModel
Assembly: AWSSDK.DynamoDBv2.dll
Version: 3.x.y.z
public sealed class DynamoDBAtomicCounterAttribute : DynamoDBRenamableAttribute
The DynamoDBAtomicCounterAttribute type exposes the following members
Name | Description | |
---|---|---|
![]() |
DynamoDBAtomicCounterAttribute() |
Default constructor |
![]() |
DynamoDBAtomicCounterAttribute(string, Int64, Int64) |
Constructor that specifies an alternate attribute name |
![]() |
DynamoDBAtomicCounterAttribute(Int64, Int64) |
Constructor that specifies an alternate attribute name |
Name | Type | Description | |
---|---|---|---|
![]() |
AttributeName | System.String | Inherited from Amazon.DynamoDBv2.DataModel.DynamoDBRenamableAttribute. |
![]() |
Delta | System.Int64 |
The value to increment (positive) or decrement (negative) the counter with for each update. |
![]() |
StartValue | System.Int64 |
The starting value of the counter. |
![]() |
TypeId | System.Object | Inherited from System.Attribute. |
public class Example { [DynamoDBAtomicCounter] public long Counter { get; set; } [DynamoDBAtomicCounter("CustomCounterName", delta: 5, startValue: 100)] public long CustomCounter { get; set; } }In this example: - `Counter` will be treated as an atomic counter with the same name in DynamoDB. - `CustomCounter` will be treated as an atomic counter with the attribute name "CustomCounterName" in DynamoDB, incremented by 5 for each update, and starting with an initial value of 100.
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer