コード例 #1
0
        public static async Task Create(Function function)
        {
            var functionsTable = await FunctionsProvider
                                 .GetFunctionsTable()
                                 .ConfigureAwait(continueOnCapturedContext: false);

            await functionsTable
            .ExecuteAsync(operation : TableOperation.Insert(entity: function))
            .ConfigureAwait(continueOnCapturedContext: false);
        }
コード例 #2
0
        public static async Task <IEnumerable <Function> > List()
        {
            var functionsTable = await FunctionsProvider
                                 .GetFunctionsTable()
                                 .ConfigureAwait(continueOnCapturedContext: false);

            var rangeQuery = new TableQuery <Function>().Where(TableQuery.GenerateFilterCondition(
                                                                   propertyName: "PartitionKey",
                                                                   operation: QueryComparisons.Equal,
                                                                   givenValue: "functions"));

            return(await functionsTable
                   .ExecuteQueryAsync(query : rangeQuery)
                   .ConfigureAwait(continueOnCapturedContext: false));
        }
コード例 #3
0
        public static async Task <Function> Get(string functionId)
        {
            var functionsTable = await FunctionsProvider
                                 .GetFunctionsTable()
                                 .ConfigureAwait(continueOnCapturedContext: false);

            var retrieveOperation = TableOperation.Retrieve <Function>(
                partitionKey: "functions",
                rowkey: functionId);

            var tableResult = await functionsTable
                              .ExecuteAsync(operation : retrieveOperation)
                              .ConfigureAwait(continueOnCapturedContext: false);

            return((Function)tableResult.Result);
        }
コード例 #4
0
        public static async Task Replace(Function function)
        {
            var functionsTable = await FunctionsProvider
                                 .GetFunctionsTable()
                                 .ConfigureAwait(continueOnCapturedContext: false);

            try
            {
                await functionsTable
                .ExecuteAsync(operation : TableOperation.Replace(entity: function))
                .ConfigureAwait(continueOnCapturedContext: false);
            }
            catch (StorageException exception)
            {
                if (exception.RequestInformation.HttpStatusCode == 404)
                {
                    throw new HttpResponseException(statusCode: HttpStatusCode.NotFound);
                }

                throw;
            }
        }
コード例 #5
0
        public static async Task Delete(string functionId)
        {
            var functionsTable = await FunctionsProvider
                                 .GetFunctionsTable()
                                 .ConfigureAwait(continueOnCapturedContext: false);

            var deleteOperation = TableOperation.Delete(entity: Function.FromId(functionId: functionId));

            try
            {
                await functionsTable
                .ExecuteAsync(operation : deleteOperation)
                .ConfigureAwait(continueOnCapturedContext: false);
            }
            catch (StorageException exception)
            {
                if (exception.RequestInformation.HttpStatusCode == 404)
                {
                    throw new HttpResponseException(statusCode: HttpStatusCode.NotFound);
                }

                throw;
            }
        }