Refactor ServiceProvider with conditional compilation
Updated the `ServiceProvider` field in the `ReC.Client` namespace to use conditional compilation for framework-specific behavior: - Added `NET8_0_OR_GREATER` directive to define `ServiceProvider` as nullable (`IServiceProvider?`) for .NET 8.0 or greater. - Retained non-nullable `IServiceProvider` for other frameworks. - Removed redundant `#if nullable` directives to simplify the code. - Streamlined initialization logic for better clarity and maintainability.
This commit is contained in:
parent
fb649a5c68
commit
71368e5c85
@ -48,15 +48,11 @@ namespace ReC.Client
|
||||
#region Static
|
||||
private static readonly IServiceCollection Services = new ServiceCollection();
|
||||
|
||||
private static IServiceProvider
|
||||
#if nullable
|
||||
?
|
||||
#if NET8_0_OR_GREATER
|
||||
private static IServiceProvider? ServiceProvider = null;
|
||||
#else
|
||||
private static IServiceProvider ServiceProvider = null;
|
||||
#endif
|
||||
ServiceProvider
|
||||
#if nullable
|
||||
= null
|
||||
#endif
|
||||
;
|
||||
|
||||
public static void BuildStaticClient(string apiUri)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user