Note: Include RequestR.Extensions.Microsoft.DependencyInjection
nuget package.
ServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddRequestBus();
Retrieve the RequestBus
instance and call the RegisterAllHandlers()
method.
RequestBus requestBus = serviceProvider.GetService<RequestBus>();
requestBus.RegisterAllHandlers();
PresentProductsRequest request = new PresentProductsRequest();
MyResponse response = requestBus.Send<MyRequest, MyResponse>(request);