private static RequestContextManager CreateRequestContextAccessor(IServiceCollection services, BoundedContextManager boundedContextManager, RequestIdFromHttpContextProvider requestIdFromHttpContextAccessor, ServiceProvider serviceProvider) { RequestCollections requestCollections = boundedContextManager.CreateRequestCollections(); var requestContextManager = new RequestContextManager(serviceProvider.GetService <IHttpContextAccessor>(), requestIdFromHttpContextAccessor, requestCollections.Request2BoundedContextId, requestCollections.Request2RequestMetadata); services.AddSingleton <IRequestContextAccessor>(requestContextManager); return(requestContextManager); }