Beispiel #1
0
 private static TableResult WriteConditionalRow(IChainTable table, TableOperationType opType, ITableEntity row,
                                                TableRequestOptions options = null, OperationContext oc = null)
 {
     try
     {
         TableOperation top = TranslateWriteOp(opType, row);
         return(table.Execute(top, options, oc));
     }
     catch (StorageException e)
     {
         return(new TableResult()
         {
             Result = null, Etag = e.RequestInformation.Etag, HttpStatusCode = e.RequestInformation.HttpStatusCode
         });
     }
     catch (Exception e)
     {
         Console.WriteLine("TryWriteConditionalRow:Error: exception {0}", e);
         return(null);
     }
 }
Beispiel #2
0
        // Single-op API: execute a single operation on an underlying table

        /*
         * RetrieveRow
         *   Read a row.
         *
         * param:
         *   A retrieve operation
         *   (Currently do not support partitionID + rowID, since Operation has another important information, i.e., deserializer)
         *
         * return:
         *   query result.
         */

        internal static TableResult RetrieveRow(IChainTable table, TableOperation operation, TableRequestOptions requestOptions = null,
                                                OperationContext operationContext = null)
        {
            TableResult retrievedResult = null;

            try
            {
                retrievedResult = table.Execute(operation, requestOptions, operationContext);
            }
            catch (StorageException e)
            {
                return(new TableResult()
                {
                    Result = null, Etag = e.RequestInformation.Etag, HttpStatusCode = e.RequestInformation.HttpStatusCode
                });
            }
            catch (Exception e)
            {
                Console.WriteLine("Error in Retrieve: caught exception {0}", e);
                return(null);
            }

            return(retrievedResult);
        }
Beispiel #3
0
 internal static TableResult RetrieveRowThrow(IChainTable table, TableOperation operation, TableRequestOptions requestOptions = null,
                                              OperationContext operationContext = null)
 {
     return(table.Execute(operation, requestOptions, operationContext));
 }