예제 #1
0
            public BusBuilder SubscribeToRequest <TRequest>() where TRequest : IRequest
            {
                using (var serviceScope = _webHost.Services.GetRequiredService <IServiceScopeFactory>().CreateScope())
                {
                    var handler = (IRequestHandler <TRequest>)serviceScope.ServiceProvider.GetService(typeof(IRequestHandler <TRequest>));

                    _bus.WithRequestHandlerAsync(handler);
                    return(this);
                }
            }