Ejemplo n.º 1
0
        public async Task InvokeAsync(HttpContext context, IScopedCustomRequestContextProvider factory)
        {
            var service = new MyScopedService();

            service.ScopedMesssage = $"MyScopedMessage! called from {context.Request.Host.Host}.";
            factory.Service        = service;

            // Call the next delegate/middleware in the pipeline
            await _next(context);
        }
Ejemplo n.º 2
0
 public ServiceController(
     ITransientService transientService,
     IScopedService scopedService,
     ISingletonService singletonService,
     IServiceProvider serviceProvider,
     IScopedCustomRequestContextProvider scopedCustomRequestContextProvider)
 {
     _transientService = transientService;
     _scopedService    = scopedService;
     _singletonService = singletonService;
     _serviceProvider  = serviceProvider;
     _scopedCustomRequestContextProvider = scopedCustomRequestContextProvider;
 }