jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
10.84k stars 1.15k forks source link

Help registering pipeline behavior #986

Closed szavoda closed 4 months ago

szavoda commented 6 months ago

I am trying to register a pipeline behavior that takes an additional type argument. While it does compile, the pipeline is not getting hit. I know it is something with the registration, but I was hoping someone smarter than I am can help me out!

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<,>));

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled for 14 days with no activity.