From 10fc56b26285ed6830804794578bdfd30f921e45 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 5 Dec 2025 23:52:25 +0100 Subject: [PATCH] Refactor: Rename ServiceProvider to Provider Renamed the static field `ServiceProvider` to `Provider` across the `ReC.Client` namespace in `ReCClient.cs` for consistency and clarity. Updated all occurrences, including declarations, usages, and exception messages. Adjusted conditional compilation blocks to reflect the new name. Ensured the `BuildStaticClient` method and `Static` property use the renamed field appropriately. --- src/ReC.Client/ReCClient.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ReC.Client/ReCClient.cs b/src/ReC.Client/ReCClient.cs index 9f81ff7..586f5fc 100644 --- a/src/ReC.Client/ReCClient.cs +++ b/src/ReC.Client/ReCClient.cs @@ -49,31 +49,31 @@ namespace ReC.Client private static readonly IServiceCollection Services = new ServiceCollection(); #if NET8_0_OR_GREATER - private static IServiceProvider? ServiceProvider = null; + private static IServiceProvider? Provider = null; #else - private static IServiceProvider ServiceProvider = null; + private static IServiceProvider Provider = null; #endif public static void BuildStaticClient(string apiUri) { - if(ServiceProvider != null) - throw new InvalidOperationException("Static ServiceProvider is already built."); + if(Provider != null) + throw new InvalidOperationException("Static Provider is already built."); Services.AddHttpClient(ClientName, client => { client.BaseAddress = new Uri(apiUri); }); - ServiceProvider = Services.BuildServiceProvider(); + Provider = Services.BuildServiceProvider(); } public static ReCClient Static { get { - if (ServiceProvider == null) - throw new InvalidOperationException("Static ServiceProvider is not built. Call BuildStaticClient first."); + if (Provider == null) + throw new InvalidOperationException("Static Provider is not built. Call BuildStaticClient first."); - var httpClientFactory = ServiceProvider.GetRequiredService(); + var httpClientFactory = Provider.GetRequiredService(); return new ReCClient(httpClientFactory); } }