public async Task Build()

in Storage/DynamoDb/SampleApplication/Utilities/DynamoDBTableBuilder.cs [18:46]


        public async Task<Table> Build()
        {
            var req = new CreateTableRequest();
            req.TableName = TableName;
            req.KeySchema = new List<KeySchemaElement>()
            {
                new KeySchemaElement() { AttributeName = "DocumentProductId",  KeyType = KeyType.HASH },
                new KeySchemaElement() { AttributeName = "PublishOn",  KeyType = KeyType.RANGE }
            };
            req.AttributeDefinitions = new List<AttributeDefinition>()
            {
                new AttributeDefinition() { AttributeName = "DocumentProductId",  AttributeType = "S" },
                new AttributeDefinition() { AttributeName = "PublishOn",  AttributeType = "S" }
            };
            req.ProvisionedThroughput = new ProvisionedThroughput()
            {
                ReadCapacityUnits = 5,
                WriteCapacityUnits = 5
            };
            try
            {
                var res = await _dynamoClient.CreateTableAsync(req);
            }
            catch (AmazonDynamoDBException addbe)
            {
                if (addbe.ErrorCode != "ResourceInUseException") throw;
            }
            return Table.LoadTable(_dynamoClient, TableName);
        }