jbogard / MediatR

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

AddOpenbehaviour not working for IStreamRequest #900

Closed albert-m-willemsen closed 1 year ago

albert-m-willemsen commented 1 year ago

AddOpenBehavior is limited to: typeof(IPipelineBehavior<,>) at the moment.

    public MediatRServiceConfiguration AddOpenBehavior(Type openBehaviorType, ServiceLifetime serviceLifetime = ServiceLifetime.Transient)
    {
        var serviceType = typeof(IPipelineBehavior<,>);

        BehaviorsToRegister.Add(new ServiceDescriptor(serviceType, openBehaviorType, serviceLifetime));

        return this;
    }

Solved it by for now by doing:

            config.AddBehavior(typeof(IStreamPipelineBehavior<,>), typeof(TimedLoggingBehaviour<,>));

in the startup.

jbogard commented 1 year ago

Yep that is missing for sure! I'll get it added to the next release.