Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 664 Bytes

File metadata and controls

26 lines (18 loc) · 664 Bytes

RequestR with Microsoft Dependency Injection

1) Setup Services

Note: Include RequestR.Extensions.Microsoft.DependencyInjection nuget package.

ServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddRequestBus();

2) Setup the Request Bus

Retrieve the RequestBus instance and call the RegisterAllHandlers() method.

RequestBus requestBus = serviceProvider.GetService<RequestBus>();
requestBus.RegisterAllHandlers();

3) Send request

PresentProductsRequest request = new PresentProductsRequest();
MyResponse response = requestBus.Send<MyRequest, MyResponse>(request);