3

我想在 ServiceStack.Aws 同步我的模型时设置自定义读/写容量。

我有这个模型

[Alias("TABLE-NAME")]
public class Company
{
    [AutoIncrement]
    public int CompanyId { get; set; }

    public int CountryId { get; set; }
    public string ShortName { get; set; }
    public string DocumentNumber { get; set; }
    public string FullName { get; set; }
    public string Address { get; set; }
    public DateTime CreatedAt { get; set; }
}

并使用此代码创建

var awsDb = new AmazonDynamoDBClient();
            var db = new PocoDynamo(awsDb)
                .RegisterTable<Company>();

            db.InitSchema();

如何设置自定义读/写容量?

4

1 回答 1

4

可以通过表 POCO 上的 ProvisionedThroughputAttribute 设置 ProvisionedThroughput 容量,或者可以通过 和 属性在客户控制默认值。PocoDynamoReadCapacityUnitsWriteCapacityUnits

表是由InitSchema调用创建的,它首先检查注册的表类型是否具有ProvisionedThroughputAttribute回退到客户端指定的容量,默认情况下设置为 10 读取,5 写入。

于 2016-06-23T02:43:51.767 回答