I have several DynamoDB tables that will act as aggregate data stores (we are 'rolling up' reports on the fly). I was hoping to use the .NET: Object Persistence Model (where you build classes that have annotations on them). The problem is the DynamoDBContext object only seems to have a 'Save' method and not a 'Save and Add values' method. Because the time between retrieving an object from Dynamo and the time to write to that row again could be larger than a trivial amount, and more than one thread could be attempting to increment, I don't want the increment to be done in the .NET code. Instead I want the .ADD AttributeAction. But I'm not sure if you can specify an attribute action with the Object Persistence Model. Does anyone know if that's possible?
[DynamoDBTable("my_table")]
public class MyRecord
{
[DynamoDBHashKey(AttributeName = "my_id")]
public string MyID{ get; set; }
/// <summary>
/// Hash of the Region and Country fields for unique data lookup from DynamoDB
/// </summary>
[DynamoDBRangeKey(AttributeName = "location")]
public string Location { get; set; }
[DynamoDBProperty("my_count")]
public int MyCount{ get; set; }
Above is a sample object. The idea is that MyID gets several 'counts' which represent user actions. I don't want to have to get mycount then add 1 in .NET then re-push. I'd rather run the 'Add' command and always send '1' to mycount and have dynamo do the math to guarantee correctness.