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); }
public ServiceController( ITransientService transientService, IScopedService scopedService, ISingletonService singletonService, IServiceProvider serviceProvider, IScopedCustomRequestContextProvider scopedCustomRequestContextProvider) { _transientService = transientService; _scopedService = scopedService; _singletonService = singletonService; _serviceProvider = serviceProvider; _scopedCustomRequestContextProvider = scopedCustomRequestContextProvider; }