在 dynamodb 中,您可以进行条件写入(参见此处和此处)。
现在,我正在使用 ServiceStack.Aws,我想知道如何实现这一点(条件写入)
我的代码看起来像这样
var awsDb = new AmazonDynamoDBClient();
var db = new PocoDynamo(awsDb);
db.UpdateItem<Country>(new Country{CountryId = 1, Name = "New Name"});
我的模型看起来像这样
[Alias("TABLE-NAME")]
public class Country
{
[AutoIncrement]
public int CountryId { get; set; }
public string Name { get; set; }
public string Culture { get; set; }
public int State { get; set; }
}
但我只想在 0 中具有“状态”属性时更新此项目