22// Licensed under the MIT license.
33//
44using Microsoft . Extensions . Configuration ;
5- using Microsoft . Extensions . Logging ;
65using Microsoft . Extensions . Primitives ;
76using System ;
87using System . Collections . Concurrent ;
@@ -26,15 +25,13 @@ sealed class ConfigurationFeatureDefinitionProvider : IFeatureDefinitionProvider
2625 private readonly IConfiguration _configuration ;
2726 private readonly ConcurrentDictionary < string , FeatureDefinition > _definitions ;
2827 private IDisposable _changeSubscription ;
29- private readonly ILogger _logger ;
3028 private int _stale = 0 ;
3129
3230 const string ParseValueErrorString = "Invalid setting '{0}' with value '{1}' for feature '{2}'." ;
3331
34- public ConfigurationFeatureDefinitionProvider ( IConfiguration configuration , ILoggerFactory loggerFactory )
32+ public ConfigurationFeatureDefinitionProvider ( IConfiguration configuration )
3533 {
3634 _configuration = configuration ?? throw new ArgumentNullException ( nameof ( configuration ) ) ;
37- _logger = loggerFactory ? . CreateLogger < ConfigurationFeatureDefinitionProvider > ( ) ?? throw new ArgumentNullException ( nameof ( loggerFactory ) ) ;
3835 _definitions = new ConcurrentDictionary < string , FeatureDefinition > ( ) ;
3936
4037 _changeSubscription = ChangeToken . OnChange (
@@ -298,18 +295,16 @@ We support
298295
299296 private IEnumerable < IConfigurationSection > GetFeatureDefinitionSections ( )
300297 {
301- //
302- // Look for feature definitions under the "FeatureManagement" section
303- IConfigurationSection featureManagementConfigurationSection = _configuration . GetSection ( ConfigurationFields . FeatureManagementSectionName ) ;
304-
305- if ( featureManagementConfigurationSection . Exists ( ) )
298+ if ( _configuration . GetChildren ( ) . Any ( s => s . Key . Equals ( ConfigurationFields . FeatureManagementSectionName , StringComparison . OrdinalIgnoreCase ) ) )
306299 {
307- return featureManagementConfigurationSection . GetChildren ( ) ;
300+ //
301+ // Look for feature definitions under the "FeatureManagement" section
302+ return _configuration . GetSection ( ConfigurationFields . FeatureManagementSectionName ) . GetChildren ( ) ;
303+ }
304+ else
305+ {
306+ return _configuration . GetChildren ( ) ;
308307 }
309-
310- _logger . LogDebug ( $ "No configuration section named '{ ConfigurationFields . FeatureManagementSectionName } ' was found.") ;
311-
312- return Enumerable . Empty < IConfigurationSection > ( ) ;
313308 }
314309
315310 private T ParseEnum < T > ( string feature , string rawValue , string fieldKeyword )
0 commit comments