Beispiel #1
0
        /// <summary>
        /// Use scoped filter for <see cref="ConsumeContext{T}" />
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="filterType">Filter type</param>
        /// <param name="lifetimeScopeProvider">Lifetime Scope Provider</param>
        public static void UseConsumeFilter(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 ScopedConsumePipeSpecificationObserver(configurator, filterType, lifetimeScopeProvider);
        }
Beispiel #2
0
        /// <summary>
        /// Use scoped filter for <see cref="ConsumeContext{T}" />
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="filterType">Filter type</param>
        /// <param name="registration">Registration Context</param>
        public static void UseConsumeFilter(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 ScopedConsumePipeSpecificationObserver(configurator, filterType, provider);
        }