public SapphireHttpSyncMiddleware(
     RequestDelegate next,
     HttpSyncConfiguration configuration,
     ILogger <SapphireHttpSyncMiddleware> logger,
     ISapphireSyncModule sapphireHttpSyncModule)
 {
     this.next                   = next;
     this.configuration          = configuration;
     this.logger                 = logger;
     this.sapphireHttpSyncModule = (SapphireHttpSyncModule)sapphireHttpSyncModule;
 }
 public SapphireHttpSyncModule(HttpSyncConfiguration configuration, IHttpClientFactory httpClientFactory)
 {
     this.configuration     = configuration;
     this.httpClientFactory = httpClientFactory;
 }
示例#3
0
        public static SapphireDatabaseBuilder AddHttpSync(this SapphireDatabaseBuilder databaseBuilder, HttpSyncConfiguration configuration)
        {
            databaseBuilder.serviceCollection.AddSingleton(configuration);

            databaseBuilder.serviceCollection.AddHttpClient <HttpClient>((client) =>
            {
                client.Timeout = TimeSpan.FromSeconds(10);
            });

            databaseBuilder.serviceCollection.AddSingleton <ISapphireSyncModule, SapphireHttpSyncModule>();

            return(databaseBuilder);
        }