Skip to content

Commit

Permalink
Add service extension method for setting the configuration. (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
tusmester authored Apr 30, 2021
1 parent eee988d commit 66445b5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/SenseNet.Tools/Configuration/SnConfigExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SenseNet.Configuration;
using SenseNet.Tools;

Expand All @@ -22,5 +23,17 @@ public static IRepositoryBuilder UseConfiguration(this IRepositoryBuilder reposi

return repositoryBuilder;
}

/// <summary>
/// Sets the provided configuration as the current configuration instance
/// used by the SnConfig infrastructure.
/// </summary>
// ReSharper disable once UnusedMember.Global
public static IServiceCollection SetSenseNetConfiguration(this IServiceCollection services, IConfiguration configuration)
{
SnConfig.Instance = configuration;

return services;
}
}
}

0 comments on commit 66445b5

Please sign in to comment.