From 66445b543ad3f37d3df107e5fa32a782fa38e338 Mon Sep 17 00:00:00 2001 From: tusmester Date: Fri, 30 Apr 2021 15:30:01 +0200 Subject: [PATCH] Add service extension method for setting the configuration. (#56) --- .../Configuration/SnConfigExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/SenseNet.Tools/Configuration/SnConfigExtensions.cs b/src/SenseNet.Tools/Configuration/SnConfigExtensions.cs index 53d5e44..ce2dfb7 100644 --- a/src/SenseNet.Tools/Configuration/SnConfigExtensions.cs +++ b/src/SenseNet.Tools/Configuration/SnConfigExtensions.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using SenseNet.Configuration; using SenseNet.Tools; @@ -22,5 +23,17 @@ public static IRepositoryBuilder UseConfiguration(this IRepositoryBuilder reposi return repositoryBuilder; } + + /// + /// Sets the provided configuration as the current configuration instance + /// used by the SnConfig infrastructure. + /// + // ReSharper disable once UnusedMember.Global + public static IServiceCollection SetSenseNetConfiguration(this IServiceCollection services, IConfiguration configuration) + { + SnConfig.Instance = configuration; + + return services; + } } }