/// <summary>
        /// Asynchronously waits till a table is created
        /// TODO: add a timeout
        /// </summary>
        private static async Task TillTableIsCreatedAsync(IAmazonDynamoDB client, string tableName)
        {
            string status = string.Empty;

            do
            {
                await Task.Delay(TimeSpan.FromSeconds(1));

                try
                {
#if AWSSDK_1_5
                    status = client.DescribeTable
                             (
                        new DescribeTableRequest {
                        TableName = tableName
                    }
                             )
                             .DescribeTableResult.Table.TableStatus;
#else
                    var response = await client.DescribeTableAsync
                                   (
                        new DescribeTableRequest { TableName = tableName }
                                   );

                    status = response.Table.TableStatus;
#endif
                }
                catch (ResourceNotFoundException)
                {
                }
            }while (status != "ACTIVE");
        }
        /// <summary>
        /// Asynchronously waits till a table is deleted
        /// TODO: add a timeout
        /// </summary>
        private static async Task TillTableIsDeletedAsync(IAmazonDynamoDB client, string tableName)
        {
            while (true)
            {
                await Task.Delay(TimeSpan.FromSeconds(1));

                try
                {
                    await client.DescribeTableAsync(new DescribeTableRequest { TableName = tableName });
                }
                catch (ResourceNotFoundException)
                {
                    break;
                }
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the Linq2DynamoDb.DataContext.DataContext class. If a table
 /// prefix is specified in config, it will be picked up automatically, rather than explicitly
 /// defining it in the constructor.
 /// </summary>
 /// <param name="client">   Returns an AmazonDynamoDb instance passed via ctor. </param>
 public DataContext(IAmazonDynamoDB client)
 {
     this._client          = client;
     this._tableNamePrefix = AWSConfigsDynamoDB.Context.TableNamePrefix;
 }
Example #4
0
 /// <summary>
 /// This ctor takes an AmazonDynamoDBClient, that will be used to load table metadata from DynamoDb
 /// </summary>
 public DataContext(IAmazonDynamoDB client, string tableNamePrefix)
 {
     this._client          = client;
     this._tableNamePrefix = tableNamePrefix;
 }
Example #5
0
 public bool IsAssignedToThisClientInstance(IAmazonDynamoDB client)
 {
     return(this._dynamoDbClientHashCode == client.GetHashCode());
 }
Example #6
0
 public CachedTableDefinitions(IAmazonDynamoDB client)
 {
     this._dynamoDbClientHashCode = client.GetHashCode();
 }