public async Task Build()

in Storage/DynamoDb/SampleApplication/Utilities/DynamoDBContextBuilder.cs [19:47]


        public async Task<DynamoDBContext> Build()
        {
            var req = new CreateTableRequest();
            req.TableName = TableName;
            req.KeySchema = new List<KeySchemaElement>()
            {
                new KeySchemaElement() { AttributeName = "ProductId",  KeyType = KeyType.HASH },
                new KeySchemaElement() { AttributeName = "PublishOn",  KeyType = KeyType.RANGE }
            };
            req.AttributeDefinitions = new List<AttributeDefinition>()
            {
                new AttributeDefinition() { AttributeName = "ProductId",  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 new DynamoDBContext(_dynamoClient);
        }