Closed jonathanhallee closed 8 months ago
I'll take a PR!
I looked into this, its does not seem possible to do this with the way pipelines are currently registered. The Dependency Injection container doesn't support registering open generics with a factory directly. It throws an exception:
"Open generic service type 'MediatR.IPipelineBehavior`2[TRequest,TResponse]' requires registering an open generic implementation type. (Parameter 'descriptors')".
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.
This issue was closed because it has been stalled for 14 days with no activity.
Hey,
We are currently in the process of migrating to Mediatr v12.1 and changing our old behavior registrations from generic
AddScoped
registrations to using the providedAddOpenBehavior
extensions.One thing we find missing is an overload of
AddOpenBehavior
that accepts aFunc<IServiceDescriptor, object>
which would allow us to more easily migrate funky registrations where we do constructor injection with a func.Example:
would be translated to something like
The ServiceDescriptor class already accepts it
I don't see anything else allowing us to do this?
Thanks!