コード例 #1
0
ファイル: Bootstrapper.cs プロジェクト: interemit/miriwork
        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);
        }