From 52d350ae489c68986834909be00e256ef233afbe Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 27 Jun 2024 12:35:37 +0200 Subject: [PATCH] Refactor: Make Build method private to ensure IServiceProvider is only created via Lazy initialization for thread safety and consistency. --- DigitalData.Core.Client/ServiceFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalData.Core.Client/ServiceFactory.cs b/DigitalData.Core.Client/ServiceFactory.cs index f689b16..4ab537c 100644 --- a/DigitalData.Core.Client/ServiceFactory.cs +++ b/DigitalData.Core.Client/ServiceFactory.cs @@ -14,7 +14,7 @@ namespace DigitalData.Core.Client "Further modifications to the service collection are not allowed. " + "This is to ensure that the dependency injection container remains in a consistent state."); - public static IServiceProvider Build() => _services.BuildServiceProvider(); + private static IServiceProvider Build() => _services.BuildServiceProvider(); public static T Provide() where T : notnull => _lazyProvider.Value.GetRequiredService(); }