コード例 #1
0
        public static IServiceCollection AddCircuitBreaker(this IServiceCollection services,
                                                           ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
        {
            var builder = new CircuitBreakerOptionBuilder();

            services.AddCircuitBreaker(builder, serviceLifetime);

            return(services);
        }
コード例 #2
0
        public static IServiceCollection AddCircuitBreaker(this IServiceCollection services,
                                                           CircuitBreakerOptionBuilder circuitBreakerOptionBuilder,
                                                           ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
        {
            if (circuitBreakerOptionBuilder is null)
            {
                throw new ArgumentNullException(nameof(circuitBreakerOptionBuilder));
            }

            services.AddCircuitBreaker(circuitBreakerOptionBuilder.Build(), serviceLifetime);

            return(services);
        }