Refactor: Make Build method private to ensure IServiceProvider is only created via Lazy initialization for thread safety and consistency.
This commit is contained in:
parent
f128a719e8
commit
52d350ae48
@ -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<T>() where T : notnull => _lazyProvider.Value.GetRequiredService<T>();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user