Ejemplo n.º 1
0
        public static IAmazonMWSBuilder AddSellersClient(this IAmazonMWSBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.TryAddScoped <IAmazonMWSSellersClient, AmazonMWSSellersClient>();
            return(builder);
        }
        public static IAmazonMWSBuilder AddAmazonMWSClients(this IAmazonMWSBuilder builder, Action <AmazonMWSClientOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (configure != null)
            {
                builder.Services.Configure(configure);
            }

            return(builder.AddFeedsClient()
                   .AddOrdersClient()
                   .AddReportsClient()
                   .AddSellersClient());
        }
 public static IAmazonMWSBuilder AddAmazonMWSClients(this IAmazonMWSBuilder builder)
 => AddAmazonMWSClients(builder, null);
        public static IAmazonMWSBuilder ConfigureExecutionRetryPolicy <TExecutionRetryPolicy>(this IAmazonMWSBuilder builder, Action <RetryPolicyOptions> configure = null)
            where TExecutionRetryPolicy : class, IExecutionRetryPolicy
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var existingRetryPolicies = builder.Services.Where(x => typeof(IExecutionRetryPolicy).IsAssignableFrom(x.ServiceType)).ToArray();

            foreach (var existingRetryPolicy in existingRetryPolicies)
            {
                builder.Services.Remove(existingRetryPolicy);
            }

            builder.Services.AddScoped <IExecutionRetryPolicy, TExecutionRetryPolicy>();

            if (configure != null)
            {
                builder.Services.Configure(configure);
            }

            return(builder);
        }
 public static IAmazonMWSBuilder ConfigureThrottleAndNetworkErrorExecutionRetryPolicy(this IAmazonMWSBuilder builder, Action <RetryPolicyOptions> configure = null)
 => ConfigureExecutionRetryPolicy <ThrottleAndNetworkErrorExecutionRetryPolicy>(builder, configure);
 public static IAmazonMWSBuilder ConfigureNoExecutionRetryPolicy(this IAmazonMWSBuilder builder)
 => ConfigureExecutionRetryPolicy <NoExecutionRetryPolicy>(builder);