Example #1
0
        private async Task CreateTableForum()
        {
            string tableName = "Forum";

            var response = await _client.CreateTableAsync(new CreateTableRequest
            {
                TableName            = tableName,
                AttributeDefinitions = new List <AttributeDefinition>()
                {
                    new AttributeDefinition
                    {
                        AttributeName = "Name",
                        AttributeType = "S"
                    }
                },
                KeySchema = new List <KeySchemaElement>()
                {
                    new KeySchemaElement
                    {
                        AttributeName = "Name", // forum Title
                        KeyType       = "HASH"
                    }
                },
                ProvisionedThroughput = new ProvisionedThroughput
                {
                    ReadCapacityUnits  = 10,
                    WriteCapacityUnits = 5
                }
            });

            await TableTools.WaitTillTableCreated(_client, tableName, response);
        }
Example #2
0
        private async Task CreateTableReply()
        {
            string tableName = "Reply";
            var    response  = await _client.CreateTableAsync(new CreateTableRequest
            {
                TableName            = tableName,
                AttributeDefinitions = new List <AttributeDefinition>()
                {
                    new AttributeDefinition
                    {
                        AttributeName = "Id",
                        AttributeType = "S"
                    },
                    new AttributeDefinition
                    {
                        AttributeName = "ReplyDateTime",
                        AttributeType = "S"
                    },
                    new AttributeDefinition
                    {
                        AttributeName = "PostedBy",
                        AttributeType = "S"
                    }
                },
                KeySchema = new List <KeySchemaElement>()
                {
                    new KeySchemaElement()
                    {
                        AttributeName = "Id",
                        KeyType       = "HASH"
                    },
                    new KeySchemaElement()
                    {
                        AttributeName = "ReplyDateTime",
                        KeyType       = "RANGE"
                    }
                },
                LocalSecondaryIndexes = new List <LocalSecondaryIndex>()
                {
                    new LocalSecondaryIndex()
                    {
                        IndexName = "PostedBy_index",


                        KeySchema = new List <KeySchemaElement>()
                        {
                            new KeySchemaElement()
                            {
                                AttributeName = "Id", KeyType = "HASH"
                            },
                            new KeySchemaElement()
                            {
                                AttributeName = "PostedBy", KeyType = "RANGE"
                            }
                        },
                        Projection = new Projection()
                        {
                            ProjectionType = ProjectionType.KEYS_ONLY
                        }
                    }
                },
                ProvisionedThroughput = new ProvisionedThroughput
                {
                    ReadCapacityUnits  = 10,
                    WriteCapacityUnits = 5
                }
            });

            await TableTools.WaitTillTableCreated(_client, tableName, response);
        }