Exemple #1
0
        /// <summary>
        /// Use scoped filter for <see cref="CompensateContext{T}" />
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="filterType">Filter type</param>
        /// <param name="provider">Configuration service provider</param>
        public static void UseCompensateActivityFilter(this IConsumePipeConfigurator configurator, Type filterType, IConfigurationServiceProvider provider)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            var lifetimeScope = provider.GetRequiredService <ILifetimeScope>();
            ILifetimeScopeProvider lifetimeScopeProvider = new SingleLifetimeScopeProvider(lifetimeScope);

            configurator.UseCompensateActivityFilter(filterType, lifetimeScopeProvider);
        }