-
Notifications
You must be signed in to change notification settings - Fork 39
Conventions
Bart Deleye edited this page Jul 11, 2011
·
1 revision
Sometimes you need to know which response type goes with a given request. For instance when implementing Interceptors.
The only place that you can know this for sure is in a RequestHandler<TRequest, TResponse> subclass, technically speaking, except when you have defined your conventions.
Defining those conventions is just a matter of implementing a simple interface:
public interface IConventions
{
Type GetResponseTypeFor(Request request);
}
And register your implementation in Agatha:
new ServiceLayerConfiguration(assembly, assembly, container)
.Use<MyConventions>()
We already created some conventions that you can use out of the box:
- BasicConventions
- For each registered xxxxRequest, use xxxxResponse
- RequestHandlerBasedConventions
- Will use each registered RequestHandler<TRequest, TResponse> to map a response type to a request type