From 23ef1a5797e88fa1304fa71138c408997dbd9a74 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Sat, 6 Dec 2025 00:10:08 +0100 Subject: [PATCH] Add scoped ReCClient and update project dependencies Added `services.AddScoped()` to both `AddRecClient` method overloads in `DependencyInjection.cs` to ensure proper scoped registration of `ReCClient`. Updated `ReC.Client.csproj` to include necessary package references for dependency injection and HTTP client support: - `Microsoft.Extensions.DependencyInjection` (v10.0.0) - `Microsoft.Extensions.Http` (v8.0.0) - `System.Net.Http` (v4.3.4) --- src/ReC.Client/DependencyInjection.cs | 2 ++ src/ReC.Client/ReC.Client.csproj | 1 + 2 files changed, 3 insertions(+) diff --git a/src/ReC.Client/DependencyInjection.cs b/src/ReC.Client/DependencyInjection.cs index aa1ddd5..d747007 100644 --- a/src/ReC.Client/DependencyInjection.cs +++ b/src/ReC.Client/DependencyInjection.cs @@ -19,6 +19,7 @@ namespace ReC.Client /// An that can be used to configure the client. public static IHttpClientBuilder AddRecClient(this IServiceCollection services, string apiUri) { + services.AddScoped(); return services.AddHttpClient(ReCClient.ClientName, client => { client.BaseAddress = new Uri(apiUri); @@ -33,6 +34,7 @@ namespace ReC.Client /// An that can be used to configure the client. public static IHttpClientBuilder AddRecClient(this IServiceCollection services, Action configureClient) { + services.AddScoped(); return services.AddHttpClient(ReCClient.ClientName, configureClient); } } diff --git a/src/ReC.Client/ReC.Client.csproj b/src/ReC.Client/ReC.Client.csproj index ea6f807..db8b30f 100644 --- a/src/ReC.Client/ReC.Client.csproj +++ b/src/ReC.Client/ReC.Client.csproj @@ -11,6 +11,7 @@ +