Exemplo n.º 1
0
        public static async Task <DocumentEntity> InsertOrMergeDocument(DocumentEntity entity)
        {
            // (Pretty) Optimistic concurrency
            // InsertOrMerge doesn't check ETag (Entity "version")

            string tableName = "documents";

            if (CheckConnectionString())
            {
                // Create a table client for interacting with the table service
                CloudTableClient cloudTableClient = storageAccount.CreateCloudTableClient();

                // Select table to work with
                CloudTable cloudTable = cloudTableClient.GetTableReference(tableName);

                try
                {
                    // Create the InsertOrReplace table operation
                    TableOperation operation = TableOperation.InsertOrMerge(entity);

                    // Execute the operation
                    TableResult result = await cloudTable.ExecuteAsync(operation);

                    return(result.Result as DocumentEntity);
                }
                catch (StorageException e)
                {
                    errorLog.Add("InsertOrMergeDocument: " + e.RequestInformation.HttpStatusCode + " " + e.Message);
                    newErrorFlag = true;
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 private async void RetrieveData()
 {
     DocumentEntity returnedEntity = await Azure.DocumentPointQueryAsync("documents", "101.310.521");
 }