Simplify ReCClient instantiation in Create method

Refactored the `Create` method in the `ReCClient` class to directly resolve a `ReCClient` instance from the dependency injection container using `Provider.GetRequiredService<ReCClient>()`.

Removed the intermediate step of retrieving an `IHttpClientFactory` and manually creating a `ReCClient` object. This change reduces boilerplate code and assumes `ReCClient` is already registered in the container, improving maintainability.
This commit is contained in:
Developer 02 2025-12-06 00:10:50 +01:00
parent 23ef1a5797
commit 3f7ebdb632

View File

@ -102,8 +102,7 @@ namespace ReC.Client
if (Provider == null) if (Provider == null)
throw new InvalidOperationException("Static Provider is not built. Call BuildStaticClient first."); throw new InvalidOperationException("Static Provider is not built. Call BuildStaticClient first.");
var httpClientFactory = Provider.GetRequiredService<IHttpClientFactory>(); return Provider.GetRequiredService<ReCClient>();
return new ReCClient(httpClientFactory);
} }
#endregion #endregion
} }