/// <summary> /// Use scoped filter for <see cref="ExecuteContext{TArguments}" /> /// </summary> /// <param name="configurator"></param> /// <param name="filterType">Filter type</param> /// <param name="lifetimeScopeProvider">Lifetime Scope Provider</param> public static void UseExecuteActivityFilter(this IConsumePipeConfigurator configurator, Type filterType, ILifetimeScopeProvider lifetimeScopeProvider) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (lifetimeScopeProvider == null) { throw new ArgumentNullException(nameof(lifetimeScopeProvider)); } var observer = new ScopedExecuteActivityPipeSpecificationObserver(filterType, lifetimeScopeProvider); configurator.ConnectActivityConfigurationObserver(observer); }
/// <summary> /// Use scoped filter for <see cref="ExecuteContext{TArguments}" /> /// </summary> /// <param name="configurator"></param> /// <param name="filterType">Filter type</param> /// <param name="registration">Registration Context</param> public static void UseExecuteActivityFilter(this IConsumePipeConfigurator configurator, Type filterType, IRegistration registration) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } if (registration == null) { throw new ArgumentNullException(nameof(registration)); } var provider = registration.GetRequiredService <IServiceProvider>(); var observer = new ScopedExecuteActivityPipeSpecificationObserver(filterType, provider); configurator.ConnectActivityConfigurationObserver(observer); }