AddHandler Method
Definition
AddHandler<THandler, TRequest, TImplementation>()
Adds a handler of type THandler to HandlerServiceTypes (if not already registered) and HandlerImplementationTypes (if not already registered).
public SavvyioOptions AddHandler<THandler, TRequest, TImplementation>() where THandler : IHandler<TRequest> where TRequest : IRequest where TImplementation : class, THandler
Returns
- SavvyioOptions
A reference to this instance so that additional configuration calls can be chained.
Type Parameters
THandlerThe type of the service to add.
TRequestThe type of the model to handle.
TImplementationThe type of the implementation to use.
Remarks
Type is only added if the following conditions are true: typeof(THandler).HasInterfaces(typeof(IHandler<TRequest>)) && typeof(T).IsClass && !typeof(T).IsAbstract && !typeof(T).IsInterface
AddHandler(Type, Type)
Adds a dispatcher of type IHandler to HandlerServiceTypes (if not already registered) and HandlerImplementationTypes (if not already registered).
public SavvyioOptions AddHandler(Type service, Type implementation)
Parameters
Returns
- SavvyioOptions
A reference to this instance so that additional configuration calls can be chained.