Example #1
0
 /// <summary>
 /// Initiates the asynchronous execution of the UpdateItem operation.
 /// </summary>
 /// <param name="doc">Document to update.</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 void UpdateItemAsync(Document doc,
                             AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(UpdateHelper(doc, MakeKey(doc), null)); },
         asyncOptions,
         callback);
 }
Example #2
0
 /// <summary>
 /// Initiates the asynchronous execution to get all the remaining results from DynamoDB.
 /// </summary>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 ///
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetRemaining
 ///         operation.</returns>
 public void GetRemainingAsync(AmazonDynamoCallback <List <T> > callback, object state)
 {
     DynamoDBAsyncExecutor.AsyncOperation(() =>
     {
         var documents  = DocumentSearch.GetRemainingHelper(true);
         List <T> items = SourceContext.FromDocumentsHelper <T>(documents, Config).ToList();
         return(items);
     }, "GetRemainingAsync", callback, state);
 }
Example #3
0
 /// <summary>
 /// Initiates the asynchronous execution of the PutItem operation.
 /// </summary>
 /// <param name="doc">Document to save.</param>
 /// <param name="config">Configuration to use.</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 void PutItemAsync(Document doc, PutItemOperationConfig config,
                          AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(PutItemHelper(doc, config)); },
         asyncOptions,
         callback);
 }
Example #4
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</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 void GetItemAsync(Primitive hashKey, Primitive rangeKey,
                          AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(GetItemHelper(MakeKey(hashKey, rangeKey), null, true)); },
         asyncOptions,
         callback);
 }
Example #5
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteItem operation.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</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 void DeleteItemAsync(Primitive hashKey, DeleteItemOperationConfig config,
                             AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { DeleteHelper(MakeKey(hashKey, null), config, true); },
         asyncOptions,
         callback);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the Delete operation.
 /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete"/>
 /// </summary>
 /// <typeparam name="T">Type of object.</typeparam>
 /// <param name="hashKey">Hash key element of the object to delete.</param>
 /// <param name="rangeKey">Range key element of the object to delete.</param>
 /// <param name="operationConfig">Config object which can be used to override that table used.</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 void DeleteAsync <T>(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig,
                             AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { DeleteHelper <T>(hashKey, rangeKey, operationConfig, true); },
         asyncOptions,
         callback);
 }
 /// <summary>
 /// Initiates the asynchronous execution to get all the remaining results from DynamoDB.
 /// </summary>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 ///
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetRemaining
 ///         operation.</returns>
 public IAsyncResult BeginGetRemaining(AsyncCallback callback, object state)
 {
     return(DynamoDBAsyncExecutor.BeginOperation(() =>
     {
         var documents = DocumentSearch.GetRemainingHelper();
         List <T> items = SourceContext.FromDocumentsHelper <T>(documents, Config).ToList();
         return items;
     }, callback, state));
 }
Example #8
0
 /// <summary>
 /// Initiates the asynchronous execution of the UpdateItem operation.
 /// </summary>
 /// <param name="doc">Attributes to update.</param>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</param>
 /// <param name="config">Configuration to use.</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 void UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config,
                             AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(UpdateHelper(doc, MakeKey(hashKey, rangeKey), config)); },
         asyncOptions,
         callback);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the Delete operation.
 /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.Delete"/>
 /// </summary>
 /// <typeparam name="T">Type of object.</typeparam>
 /// <param name="value">Object to delete.</param>
 /// <param name="operationConfig">Overriding configuration.</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 void DeleteAsync <T>(T value, DynamoDBOperationConfig operationConfig,
                             AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { DeleteHelper <T>(value, operationConfig, true); },
         asyncOptions,
         callback);
 }
Example #10
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteItem operation.
 /// </summary>
 /// <param name="document">Document to delete.</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 void DeleteItemAsync(Document document,
                             AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { DeleteHelper(MakeKey(document), null); },
         asyncOptions,
         callback);
 }
Example #11
0
 /// <summary>
 /// Initiates the asynchronous execution of the UpdateItem operation.
 /// </summary>
 /// <param name="doc">Attributes to update.</param>
 /// <param name="key">Key of the document.</param>
 /// <param name="config">Configuration to use.</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 void UpdateItemAsync(Document doc, IDictionary <string, DynamoDBEntry> key, UpdateItemOperationConfig config,
                             AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(UpdateHelper(doc, MakeKey(key), config)); },
         asyncOptions,
         callback);
 }
Example #12
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteItem operation.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="rangeKey">Range key element of the document.</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 void DeleteItemAsync(Primitive hashKey, Primitive rangeKey,
                             AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { DeleteHelper(MakeKey(hashKey, rangeKey), null); },
         asyncOptions,
         callback);
 }
Example #13
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteItem operation.
 /// </summary>
 /// <param name="key">Key of the document.</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 void DeleteItemAsync(IDictionary <string, DynamoDBEntry> key,
                             AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { DeleteHelper(MakeKey(key), null); },
         asyncOptions,
         callback);
 }
Example #14
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// </summary>
 /// <param name="key">Key of the document.</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 void GetItemAsync(IDictionary <string, DynamoDBEntry> key,
                          AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(GetItemHelper(MakeKey(key), null)); },
         asyncOptions,
         callback);
 }
Example #15
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetItem operation.
 /// </summary>
 /// <param name="hashKey">Hash key element of the document.</param>
 /// <param name="config">Configuration to use.</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 void GetItemAsync(Primitive hashKey, GetItemOperationConfig config,
                          AmazonDynamoDBCallback <Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <Document>(
         () => { return(GetItemHelper(MakeKey(hashKey, null), config)); },
         asyncOptions,
         callback);
 }
        /// <summary>
        /// Executes a Query operation against DynamoDB, finding items
        /// that match the specified range element condition for a hash-and-range primary key.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="hashKeyValue">Hash key of the items to query.</param>
        /// <param name="op">Operation of the condition.</param>
        /// <param name="values">
        /// Value(s) of the condition.
        /// For all operations except QueryOperator.Between, values should be one value.
        /// For QueryOperator.Between, values should be two values.
        /// </param>
        /// <returns>Lazy-loaded collection of results.</returns>
        internal IEnumerable <T> Query <T>(object hashKeyValue, QueryOperator op, params object[] values)
        {
            DynamoDBAsyncExecutor.IsMainThread("QueryAsync");
            if (values == null || values.Length == 0)
            {
                throw new ArgumentOutOfRangeException("values");
            }

            return(Query <T>(hashKeyValue, op, values, null));
        }
        /// <summary>
        /// Executes a Scan operation against DynamoDB, finding items
        /// that match the specified conditions.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="conditions">
        /// Conditions that the results should meet.
        /// </param>
        /// <returns>Lazy-loaded collection of results.</returns>
        internal IEnumerable <T> Scan <T>(params ScanCondition[] conditions)
        {
            DynamoDBAsyncExecutor.IsMainThread("ScanAsync");
            if (conditions == null)
            {
                throw new ArgumentNullException("conditions");
            }

            return(Scan <T>(conditions, null));
        }
Example #18
0
        /// <summary>
        /// Initiates the asynchronous execution of the ExecuteBatchWrite operation.
        /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.ExecuteBatchWrite"/>
        /// </summary>
        /// <param name="batches">Configured BatchWrite objects</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 void ExecuteBatchWriteAsync <T>(BatchWrite[] batches, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
        {
            asyncOptions = asyncOptions ?? new AsyncOptions();
            MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);

            DynamoDBAsyncExecutor.ExecuteAsync(
                () => { superBatch.ExecuteHelper(true); },
                asyncOptions,
                callback);
        }
Example #19
0
 /// <summary>
 /// Initiates the asynchronous execution of the Load operation.
 /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.Load"/>
 /// </summary>
 /// <typeparam name="T">Type to populate.</typeparam>
 /// <param name="hashKey">Hash key element of the target item.</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 void LoadAsync <T>(object hashKey, AmazonDynamoDBCallback <T> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <T>(
         () =>
     {
         return(LoadHelper <T>(hashKey, null, null, true));
     },
         asyncOptions,
         callback);
 }
Example #20
0
 /// <summary>
 /// Initiates the asynchronous execution of the Load operation.
 /// </summary>
 /// <typeparam name="T">Type to populate.</typeparam>
 /// <param name="keyObject">Key of the target item.</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 void LoadAsync <T>(T keyObject, AmazonDynamoDBCallback <T> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <T>(
         () =>
     {
         return(LoadHelper <T>(keyObject, null));
     },
         asyncOptions,
         callback);
 }
Example #21
0
 /// <summary>
 /// Configures an async Query operation against DynamoDB, finding items
 /// that match the specified hash primary key.
 /// </summary>
 /// <typeparam name="T">Type of object.</typeparam>
 /// <param name="hashKeyValue">Hash key of the items to query.</param>
 /// <param name="operationConfig">Config object which can be used to override the table used.</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 void QueryAsync <T>(object hashKeyValue, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <AsyncSearch <T> > callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <AsyncSearch <T> >(
         () =>
     {
         ContextSearch query = ConvertQueryByValue <T>(hashKeyValue, null, operationConfig);
         return(FromSearchAsync <T>(query));
     },
         asyncOptions,
         callback);
 }
        /// <summary>
        /// Executes a Scan operation against DynamoDB, finding items
        /// that match the specified conditions.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="scanConfig">Scan request object.</param>
        /// <param name="operationConfig">Config object which can be used to override the table used.</param>
        /// <returns>Lazy-loaded collection of results.</returns>
        internal IEnumerable <T> FromScan <T>(ScanOperationConfig scanConfig, DynamoDBOperationConfig operationConfig)
        {
            DynamoDBAsyncExecutor.IsMainThread("FromScanAsync");
            if (scanConfig == null)
            {
                throw new ArgumentNullException("scanConfig");
            }

            var scan = ConvertFromScan <T>(scanConfig, operationConfig);

            return(FromSearch <T>(scan));
        }
Example #23
0
 /// <summary>
 /// Initiates the asynchronous execution of the Load operation.
 /// </summary>
 /// <typeparam name="T">Type to populate.</typeparam>
 /// <param name="hashKey">Hash key element of the target item.</param>
 /// <param name="rangeKey">Range key element of the target item.</param>
 /// <param name="operationConfig">Overriding configuration.</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 void LoadAsync <T>(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig,
                           AmazonDynamoDBCallback <T> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <T>(
         () =>
     {
         return(LoadHelper <T>(hashKey, rangeKey, operationConfig));
     },
         asyncOptions,
         callback);
 }
        /// <summary>
        /// Executes a Query operation against DynamoDB, finding items
        /// that match the specified range element condition for a hash-and-range primary key.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="hashKeyValue">Hash key of the items to query.</param>
        /// <param name="op">Operation of the condition.</param>
        /// <param name="values">
        /// Value(s) of the condition.
        /// For all operations except QueryOperator.Between, values should be one value.
        /// For QueryOperator.Between, values should be two values.
        /// </param>
        /// <param name="operationConfig">Config object which can be used to override the table used.</param>
        /// <returns>Lazy-loaded collection of results.</returns>
        internal IEnumerable <T> Query <T>(object hashKeyValue, QueryOperator op, IEnumerable <object> values, DynamoDBOperationConfig operationConfig)
        {
            DynamoDBAsyncExecutor.IsMainThread("QueryAsync");
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            var query = ConvertQueryByValue <T>(hashKeyValue, op, values, operationConfig);

            return(FromSearch <T>(query));
        }
        /// <summary>
        /// Executes a Query operation against DynamoDB, finding items
        /// that match the specified conditions.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="queryConfig">Query request object.</param>
        /// <param name="operationConfig">Config object which can be used to override the table used.</param>
        /// <returns>Lazy-loaded collection of results.</returns>
        internal IEnumerable <T> FromQuery <T>(QueryOperationConfig queryConfig, DynamoDBOperationConfig operationConfig)
        {
            DynamoDBAsyncExecutor.IsMainThread("FromQueryAsync");
            if (queryConfig == null)
            {
                throw new ArgumentNullException("queryConfig");
            }

            var search = ConvertFromQuery <T>(queryConfig, operationConfig);

            return(FromSearch <T>(search));
        }
Example #26
0
 /// <summary>
 /// Initiates the asynchronous execution of the UploadFrom operation.
 /// </summary>
 /// <param name="sourcePath">Path of the file to be uploaded.</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 void UploadFromAsync(string sourcePath, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () =>
     {
         this.s3ClientCache.GetClient(this.RegionAsEndpoint).UploadObjectFromFilePath(
             this.linker.s3.bucket, this.linker.s3.key, sourcePath, null);
     },
         asyncOptions,
         callback);
 }
Example #27
0
 /// <summary>
 /// Initiates the asynchronous execution of the DownloadTo operation.
 /// </summary>
 /// <param name="downloadPath">Path to save the file.</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 void DownloadToAsync(string downloadPath, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () =>
     {
         this.s3ClientCache.GetClient(this.RegionAsEndpoint).DownloadToFilePath(
             this.linker.s3.bucket, this.linker.s3.key, downloadPath, null);
     },
         asyncOptions,
         callback);
 }
        /// <summary>
        /// Executes a Scan operation against DynamoDB, finding items
        /// that match the specified conditions.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="conditions">
        /// Conditions that the results should meet.
        /// </param>
        /// <param name="operationConfig">Config object which can be used to override the table used.</param>
        /// <returns>Lazy-loaded collection of results.</returns>
        internal IEnumerable <T> Scan <T>(IEnumerable <ScanCondition> conditions, DynamoDBOperationConfig operationConfig)
        {
            DynamoDBAsyncExecutor.IsMainThread("ScanAsync");
            if (conditions == null)
            {
                throw new ArgumentNullException("conditions");
            }

            var scan = ConvertScan <T>(conditions, operationConfig);

            return(FromSearch <T>(scan));
        }
Example #29
0
 /// <summary>
 /// Initiates the asynchronous execution to get all the remaining results from DynamoDB.
 /// </summary>
 /// <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 void GetRemainingAsync(AmazonDynamoDBCallback <List <T> > callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync <List <T> >(
         () =>
     {
         var documents  = DocumentSearch.GetRemainingHelper(true);
         List <T> items = SourceContext.FromDocumentsHelper <T>(documents, Config).ToList();
         return(items);
     },
         asyncOptions,
         callback);
 }
Example #30
0
        /// <summary>
        /// Creates a strongly-typed BatchWrite object, allowing
        /// a batch-write operation against DynamoDB.
        /// </summary>
        /// <typeparam name="T">Type of objects to write</typeparam>
        /// <param name="operationConfig">Config object which can be used to override that table used.</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 void CreateBatchWriteAsync <T>(DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback <BatchWrite <T> > callback, AsyncOptions asyncOptions = null)
        {
            asyncOptions = asyncOptions ?? new AsyncOptions();

            DynamoDBAsyncExecutor.ExecuteAsync(
                () =>
            {
                DynamoDBFlatConfig config = new DynamoDBFlatConfig(operationConfig, this.Config);
                return(new BatchWrite <T>(this, config));;
            },
                asyncOptions,
                callback);
        }