From d5a8619b4df52fe51ecc4ba5f175be0d2919f832 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 30 Sep 2025 19:55:40 +0200 Subject: [PATCH] Add repository access methods to Static class This commit introduces two new properties in the `Static` class: `Repository` and `GetRepository()`. The `Repository` property allows retrieval of an `IRepository` instance from the service provider, while `GetRepository()` provides access to a specific `IRepository`. These additions improve the ease of accessing repository instances for data operations. --- DigitalData.Core.Infrastructure/Static.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DigitalData.Core.Infrastructure/Static.cs b/DigitalData.Core.Infrastructure/Static.cs index 5348a14..8641936 100644 --- a/DigitalData.Core.Infrastructure/Static.cs +++ b/DigitalData.Core.Infrastructure/Static.cs @@ -2,6 +2,7 @@ using System; #endif +using DigitalData.Core.Abstraction.Application.Repository; using Microsoft.Extensions.DependencyInjection; namespace DigitalData.Core.Infrastructure @@ -22,6 +23,10 @@ public class Static private static readonly Lazy LazyProvider = new Lazy(Services.BuildServiceProvider); public static IServiceProvider Provider => LazyProvider.Value; + + public static IRepository Repository => Provider.GetRequiredService(); + + public static IRepository GetRepository() => Provider.GetRequiredService>(); } #if NETFRAMEWORK