From ebf79309d12991c22d8248a9e6a11f867d107942 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 30 Sep 2025 19:58:22 +0200 Subject: [PATCH] Refactor Static class to be generic Updated the `Static` class in the `DigitalData.Core.Infrastructure` namespace to a generic version `Static`. Removed the original non-generic class and the `GetRepository` method. The new generic class provides a method to retrieve a repository for a specific entity type `TEntity`, enhancing type safety and usability. --- DigitalData.Core.Infrastructure/Static.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DigitalData.Core.Infrastructure/Static.cs b/DigitalData.Core.Infrastructure/Static.cs index c5cc6ee..f7f4c7b 100644 --- a/DigitalData.Core.Infrastructure/Static.cs +++ b/DigitalData.Core.Infrastructure/Static.cs @@ -12,7 +12,7 @@ namespace DigitalData.Core.Infrastructure { #endif -public class Static +public static class Static { private readonly static Lazy LazyServices = new Lazy(() => new ServiceCollection()); @@ -25,8 +25,11 @@ public class Static public static IServiceProvider Provider => LazyProvider.Value; public static IRepository Repository => Provider.GetRequiredService(); +} - public static IRepository GetRepository() => Provider.GetRequiredService>(); +public static class Static +{ + public static IRepository Repository() => Static.Provider.GetRequiredService>(); } #if NETFRAMEWORK