Reputation: 1040
With Mediatr 9, I am trying to register a pipeline behavior that takes an additional type argument. While it does compile, the pipeline is not getting hit.
Validation Pipeline Signature:
public class EnvelopeValidationHandlerAsync<TRequest, TResponse, TRequestItem> : IPipelineBehavior<TRequest, TResponse>
where TRequest : RequestEnvelope<TRequestItem, Response<TResponse>>
where TRequestItem : RequestItem, new()
where TResponse: class
Request Signature:
public class CreatePatientRequestEnvelope: RequestEnvelope<CreatePatientRequest, Response<PatientResponse>>
public class CreatePatientRequest : RequestItem
Request Envelope:
public class RequestEnvelope<TRequestItem, TResponse> : Request<TResponse>, IRequestEnvelope<TRequestItem, TResponse>
where TRequestItem : IRequestItem, new()
Using Autofac, I am registering as:
containerBuilder.RegisterGeneric(typeof(EnvelopeValidationHandlerAsync<,,>)).As(typeof(IPipelineBehavior<,>));
Upvotes: 1
Views: 45