From 4ee79d6cd8af966cab2f0ef0bc1fd6dbcccc026d Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 5 Dec 2025 23:17:45 +0100 Subject: [PATCH] Refactor ReCClient for cleaner and more flexible design - Removed unused `System.Xml.Linq` namespace import. - Simplified code by removing `#if NETFRAMEWORK` directives. - Added `ClientName` field to uniquely identify HTTP clients. - Updated constructor to use named HTTP client with `ClientName`. - Removed unused `_jsonOptions` field for better code clarity. --- src/ReC.Client/ReCClient.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ReC.Client/ReCClient.cs b/src/ReC.Client/ReCClient.cs index e314da5..adcbf09 100644 --- a/src/ReC.Client/ReCClient.cs +++ b/src/ReC.Client/ReCClient.cs @@ -1,12 +1,9 @@ using System.Text.Json; -using System.Xml.Linq; - #if NETFRAMEWORK using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; -#else #endif namespace ReC.Client @@ -14,11 +11,12 @@ namespace ReC.Client public class ReCClient { private readonly HttpClient _http; - private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }; + + public static readonly string ClientName = Guid.NewGuid().ToString(); public ReCClient(IHttpClientFactory httpClientFactory) { - _http = httpClientFactory.CreateClient(); + _http = httpClientFactory.CreateClient(ClientName); } ///