From 5a3cbe8ecff0fb61c1045982b82c881f50e7a449 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 30 Sep 2025 19:56:58 +0200 Subject: [PATCH] Improve exception message in Static.cs Updated the exception message in the `Static` class to clarify that services cannot be accessed after the service provider has been created. This change enhances the clarity of the error for developers. --- DigitalData.Core.Infrastructure/Static.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DigitalData.Core.Infrastructure/Static.cs b/DigitalData.Core.Infrastructure/Static.cs index 8641936..c5cc6ee 100644 --- a/DigitalData.Core.Infrastructure/Static.cs +++ b/DigitalData.Core.Infrastructure/Static.cs @@ -17,8 +17,8 @@ public class Static private readonly static Lazy LazyServices = new Lazy(() => new ServiceCollection()); public static IServiceCollection Services => LazyProvider.IsValueCreated - ? LazyServices.Value - : throw new InvalidOperationException("Service collection is not available after the service provider has been built."); + ? LazyServices.Value + : throw new InvalidOperationException("Services cannot be accessed after the Provider has been created."); private static readonly Lazy LazyProvider = new Lazy(Services.BuildServiceProvider);