I have a class FooBehavior implemented as follows:
public class FooBehavior : IPipelineBehavior<FooCommand, string>
{
public Task<string> Handle(FooCommand request, CancellationToken cancellationToken, RequestHandlerDelegate<string> next)
{
throw new NotImplementedException();
}
}
and I'm registering MediatR with just services.AddMediatR(typeof(FooHandler)) (where FooHandler and FooBehavior live in the same assembly). When running the application and sending a FooCommand, I don't see the behavior at all - I was expecting the application to throw, but it just keeps going as if nothing happened.
I have a class
FooBehavior
implemented as follows:and I'm registering MediatR with just
services.AddMediatR(typeof(FooHandler))
(whereFooHandler
andFooBehavior
live in the same assembly). When running the application and sending aFooCommand
, I don't see the behavior at all - I was expecting the application to throw, but it just keeps going as if nothing happened.I think the problem might be these lines:
https://github.com/jbogard/MediatR.Extensions.Microsoft.DependencyInjection/blob/886b54b1301cbfb3decc71ee0e139398f400aab1/src/MediatR.Extensions.Microsoft.DependencyInjection/ServiceCollectionExtensions.cs#L91-L95
Should
IPipelineBehavior<,>
be among those interfaces? If not, what's the rationale behind leaving it out?If you want it there, I can file a PR for the fix :)