Ejemplo n.º 1
0
 public TodoController(TodoContext todoContext,
                       ILogger <TodoController> logger,
                       IOperationTransien operationTransien,
                       IOperationScope operationScope,
                       IOperationSingleton operationSingleton,
                       IOptionsMonitor <PositionOptions> optionsMonitor,
                       IOptionsSnapshot <TopItemSettings> namedOptionsAccessor,
                       IOptions <MyConfigOptions> options,
                       IHttpClientFactory httpClientFactory,
                       IMemoryCache cache,
                       IDistributedCache distributedCache)
 {
     _todoContext        = todoContext;
     _logger             = logger;
     _operationTransien  = operationTransien;
     _operationScope     = operationScope;
     _operationSingleton = operationSingleton;
     _positionOptions    = optionsMonitor.CurrentValue;
     _monthTopItem       = namedOptionsAccessor.Get(TopItemSettings.Month);
     _yearTopItem        = namedOptionsAccessor.Get(TopItemSettings.Year);
     _myConfigOptions    = options.Value;
     _clientFactory      = httpClientFactory;
     _cache            = cache;
     _distributedCache = distributedCache;
 }
Ejemplo n.º 2
0
        public async Task Invoke(HttpContext httpContext,
                                 ILogger <RequestSetOptionsMiddleware> logger,
                                 IOperationTransien operationTransien,
                                 IOperationScope operationScope,
                                 IOperationSingleton operationSingleton)
        {
            var option = httpContext.Request.Query["option"];

            logger.LogInformation($"transient id is {operationTransien.OperationId}");
            logger.LogInformation($"scope id is {operationScope.OperationId}");
            logger.LogInformation($"singleton id is {operationSingleton.OperationId}");
            if (!string.IsNullOrEmpty(option))
            {
                httpContext.Items["option"] = WebUtility.HtmlEncode(option);
            }
            await _next(httpContext);
        }