/// <inheritdoc />
        public async Task <GetAllEnumerationValuesResponse> GetAllEnumerationValuesAsync(CancellationToken cancellationToken)
        {
            const string cacheKeyName = "__AllEnumerations";
            GetAllEnumerationValuesResponse toReturn = null;

            this.loggerWrapper.Debug(
                $"Pulling back {nameof(AllEnumerationValuesResult)} from the " +
                $"{nameof(ICacheManager)}...");

            object unboxedEnumerationValuesResult =
                await this.cacheManager.GetAsync(cacheKeyName, cancellationToken)
                .ConfigureAwait(false);

            AllEnumerationValuesResult enumerationValuesResult =
                unboxedEnumerationValuesResult as AllEnumerationValuesResult;

            // Result will be non-null.
            this.loggerWrapper.Info(
                $"{nameof(AllEnumerationValuesResult)} pulled back from the " +
                $"{nameof(ICacheManager)}: {enumerationValuesResult}.");

            toReturn = new GetAllEnumerationValuesResponse()
            {
                Enumerations = enumerationValuesResult.Enumerations,
            };

            return(toReturn);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> RunAsync(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = "enumerations")]
            HttpRequest httpRequest,
            CancellationToken cancellationToken)
        {
            this.httpSpiExecutionContextManager.SetContext(httpRequest.Headers);

            this.loggerWrapper.Debug(
                $"Invoking {nameof(IGetAllEnumerationValuesProcessor)}");

            GetAllEnumerationValuesResponse getEnumerationValuesResponse =
                await this.getAllEnumerationsProcessor.GetAllEnumerationValuesAsync(
                    cancellationToken)
                .ConfigureAwait(false);

            this.loggerWrapper.Info(
                $"{nameof(IGetAllEnumerationValuesProcessor)} invoked with " +
                $"success: {getEnumerationValuesResponse}.");

            return(new JsonResult(getEnumerationValuesResponse));
        }