From 52a7664e5779da1e32ac23350883152390064f84 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 25 Nov 2024 10:58:45 +0100 Subject: [PATCH] =?UTF-8?q?fix(Client.DIExtensions):=20Generischer=20Typ?= =?UTF-8?q?=20zur=20Injektion=20mehrerer=20Client-Dienste=20hinzugef=C3=BC?= =?UTF-8?q?gt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.Core.Client/BaseHttpClientService.cs | 1 - DigitalData.Core.Client/DIExtensions.cs | 5 +++-- DigitalData.Core.Client/HttpClientService.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DigitalData.Core.Client/BaseHttpClientService.cs b/DigitalData.Core.Client/BaseHttpClientService.cs index 24ea3ef..d9c8670 100644 --- a/DigitalData.Core.Client/BaseHttpClientService.cs +++ b/DigitalData.Core.Client/BaseHttpClientService.cs @@ -1,5 +1,4 @@ using DigitalData.Core.Abstractions.Client; -using Microsoft.Extensions.Options; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Web; diff --git a/DigitalData.Core.Client/DIExtensions.cs b/DigitalData.Core.Client/DIExtensions.cs index f67d2e4..f1aeff6 100644 --- a/DigitalData.Core.Client/DIExtensions.cs +++ b/DigitalData.Core.Client/DIExtensions.cs @@ -8,13 +8,14 @@ namespace DigitalData.Core.Client { public static class DIExtensions { - public static IServiceCollection AddHttpClientService(this IServiceCollection services, IConfigurationSection? section = null) + public static IServiceCollection AddHttpClientService(this IServiceCollection services, IConfigurationSection? section = null) + where THttpClientOptions : HttpClientOptions { services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); if(section is not null) - services.Configure(section); + services.Configure(section); return services; } diff --git a/DigitalData.Core.Client/HttpClientService.cs b/DigitalData.Core.Client/HttpClientService.cs index e7543fb..5820d21 100644 --- a/DigitalData.Core.Client/HttpClientService.cs +++ b/DigitalData.Core.Client/HttpClientService.cs @@ -7,7 +7,7 @@ namespace DigitalData.Core.Client public class HttpClientService : BaseHttpClientService, IHttpClientService, IBaseHttpClientService where TClientOptions : HttpClientOptions { - public HttpClientService(HttpClient client, CookieContainer cookieContainer, IOptions clientOptions) : base(client, cookieContainer, clientOptions) + public HttpClientService(HttpClient client, CookieContainer cookieContainer, IOptions clientOptions) : base(client, cookieContainer, clientOptions.Value) { } }