Registering generic type with type constraint in .NET Core (MS.DI)
问题 I have a generic interface IPipelineBehavior<TRequest, TResponse> (from MediatR). I'm trying to register a specific behavior for this interface as follows: services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationMiddleware<,>)); ValidationMiddleware implements IPipelineBehavior like so: public class ValidationMiddleware<TRequest, TResponse> : IPipelineBehavior<TRequest, Result<TResponse>> Result is a custom class I want all of my MediatR IRequestHandlers to return. When the app