internal Table Copy(TableConfig newConfig) { return(new Table(this.DDBClient, newConfig) { Keys = this.Keys, RangeKeys = this.RangeKeys, HashKeys = this.HashKeys, Attributes = this.Attributes, GlobalSecondaryIndexes = this.GlobalSecondaryIndexes, GlobalSecondaryIndexNames = this.GlobalSecondaryIndexNames, LocalSecondaryIndexes = this.LocalSecondaryIndexes, LocalSecondaryIndexNames = this.LocalSecondaryIndexNames }); }
/// <summary> /// Creates a Table object with the specified configuration, 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="config">Configuration to use for the table.</param> /// <param name="table">Loaded table.</param> /// <returns> /// True if table was successfully loaded; otherwise false. /// </returns> public static bool TryLoadTable(IAmazonDynamoDB ddbClient, TableConfig config, out Table table) { if (config == null) { throw new ArgumentNullException("config"); } try { table = LoadTable(ddbClient, config); return(true); } catch { table = null; return(false); } }
private Table(IAmazonDynamoDB ddbClient, TableConfig config) { if (config == null) { throw new ArgumentNullException("config"); } if (ddbClient == null) { throw new ArgumentNullException("ddbClient"); } #if PCL || UNITY || CORECLR DDBClient = ddbClient as AmazonDynamoDBClient; #else DDBClient = ddbClient; #endif Config = config; }
/// <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="conversion">Conversion to use for converting .NET values to DynamoDB values.</param> /// <param name="table">Loaded table.</param> /// <returns> /// True if table was successfully loaded; otherwise false. /// </returns> public static bool TryLoadTable(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, out Table table) { var config = new TableConfig(tableName, conversion, DynamoDBConsumer.DocumentModel, storeAsEpoch: null); return(TryLoadTable(ddbClient, config, out table)); }
/// <summary> /// Creates a Table object with the specified name, using the /// passed-in client to load the table definition. /// /// This method return an exception if the table does not exist within the callback. /// </summary> /// <param name="ddbClient">Client to use to access DynamoDB.</param> /// <param name="tableName">Name of the table.</param> /// <param name="conversion">Conversion to use for converting .NET values to DynamoDB values.</param> /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param> public static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback <Table> callback, AsyncOptions asyncOptions = null) { var config = new TableConfig(tableName, conversion, DynamoDBConsumer.DocumentModel, storeAsEpoch: null); LoadTableAsync(ddbClient, config, callback, asyncOptions); }