123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using Microsoft.Extensions.Configuration;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EasyDevCore.Configuration
- {
- /// <summary>
- ///
- /// </summary>
- /// <seealso cref="Microsoft.Extensions.Configuration.IConfigurationSource" />
- public class SubstitutingConfigurationSource : IConfigurationSource
- {
- /// <summary>
- /// The configuration root
- /// </summary>
- private readonly IConfigurationRoot _configurationRoot;
- /// <summary>
- /// The constant section
- /// </summary>
- private readonly string _variablesSection;
- /// <summary>
- /// Initializes a new instance of the <see cref="SubstitutingConfigurationSource"/> class.
- /// </summary>
- /// <param name="configurationRoot">The configuration root.</param>
- /// <param name="variablesSection">The variables section.</param>
- public SubstitutingConfigurationSource(IConfigurationRoot configurationRoot, string variablesSection)
- {
- _configurationRoot = configurationRoot;
- _variablesSection = variablesSection;
- }
- /// <summary>
- /// Builds the <see cref="T:Microsoft.Extensions.Configuration.IConfigurationProvider" /> for this source.
- /// </summary>
- /// <param name="builder">The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder" />.</param>
- /// <returns>
- /// An <see cref="T:Microsoft.Extensions.Configuration.IConfigurationProvider" />
- /// </returns>
- public IConfigurationProvider Build(IConfigurationBuilder builder)
- {
- return new SubstitutingConfigurationProvider(_configurationRoot, _variablesSection);
- }
- }
- }
|