Beispiel #1
0
 private Table(AmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer)
 {
     DDBClient = ddbClient;
     TableConsumer = consumer;
     TableName = tableName;
     HashKeyIsNumeric = RangeKeyIsDefined = RangeKeyIsNumeric = false;
 }
Beispiel #2
0
 private Table(AmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer)
 {
     DDBClient = ddbClient;
     TableConsumer = consumer;
     TableName = tableName;
     RangeKeyIsDefined = false;
     HashKeyType = DynamoDBEntryType.String;
     RangeKeyType = DynamoDBEntryType.String;
 }
Beispiel #3
0
 internal Table Copy(Table.DynamoDBConsumer newConsumer)
 {
     return new Table(this.DDBClient, this.TableName, newConsumer)
     {
         HashKeyType = this.HashKeyType,
         HashKeyName = this.HashKeyName,
         keyNames = this.keyNames,
         RangeKeyIsDefined = this.RangeKeyIsDefined,
         RangeKeyType = this.RangeKeyType,
         RangeKeyName = this.RangeKeyName,
     };
 }
Beispiel #4
0
 internal static Table LoadTable(AmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer)
 {
     Table table = new Table(ddbClient, tableName, consumer);
     table.GetKeyInfo();
     return table;
 }
Beispiel #5
0
 /// <summary>
 /// Creates a Table object with the specified name, using the
 /// passed-in client to load the table definition.
 /// 
 /// This method will return false if the table does not exist.
 /// </summary>
 /// <param name="ddbClient">Client to use to access DynamoDB.</param>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="table">Loaded table.</param>
 /// <returns>
 /// True if table was successfully loaded; otherwise false.
 /// </returns>
 public static bool TryLoadTable(AmazonDynamoDB ddbClient, string tableName, out Table table)
 {
     try
     {
         table = LoadTable(ddbClient, tableName);
         return true;
     }
     catch
     {
         table = null;
         return false;
     }
 }
Beispiel #6
0
 /// <summary>
 /// Creates a Table object with the specified name, using the
 /// passed-in client to load the table definition.
 /// 
 /// This method will throw an exception if the table does not exist.
 /// </summary>
 /// <param name="ddbClient">Client to use to access DynamoDB.</param>
 /// <param name="tableName">Name of the table.</param>
 /// <returns>Table object representing the specified table.</returns>
 public static Table LoadTable(AmazonDynamoDB ddbClient, string tableName)
 {
     Table table = new Table(ddbClient, tableName, Table.DynamoDBConsumer.DocumentModel);
     table.GetKeyInfo();
     return table;
 }
 /// <summary>
 /// Constructs a DocumentBatchGet instance for a specific table.
 /// </summary>
 /// <param name="targetTable">Table to get items from.</param>
 public DocumentBatchGet(Table targetTable)
 {
     TargetTable = targetTable;
     Keys = new List<Key>();
 }
        private void SetupTable()
        {
            try
            {
                this._table = Table.LoadTable(this._ddbClient, this._tableName, Table.DynamoDBConsumer.SessionStateProvider);
            }
            catch (ResourceNotFoundException) { }

            if (this._table == null)
            {
                if (this._createIfNotExist)
                    this._table = CreateTable();
                else
                    throw new AmazonDynamoDBException(string.Format("Table {0} was not found to be used to store session state and autocreate is turned off.", this._tableName));
            }
            else
            {
                ValidateTable();
            }
        }