@@ -20,18 +20,14 @@ class ConfigurationReader : IConfigurationReader
20
20
readonly IConfigurationSection _section ;
21
21
readonly IReadOnlyCollection < Assembly > _configurationAssemblies ;
22
22
readonly ResolutionContext _resolutionContext ;
23
- #if NETSTANDARD || NET461
24
23
readonly IConfigurationRoot _configurationRoot ;
25
- #endif
26
24
27
25
public ConfigurationReader ( IConfigurationSection configSection , AssemblyFinder assemblyFinder , IConfiguration configuration = null )
28
26
{
29
27
_section = configSection ?? throw new ArgumentNullException ( nameof ( configSection ) ) ;
30
28
_configurationAssemblies = LoadConfigurationAssemblies ( _section , assemblyFinder ) ;
31
29
_resolutionContext = new ResolutionContext ( configuration ) ;
32
- #if NETSTANDARD || NET461
33
30
_configurationRoot = configuration as IConfigurationRoot ;
34
- #endif
35
31
}
36
32
37
33
// Used internally for processing nested configuration sections -- see GetMethodCalls below.
@@ -40,9 +36,7 @@ internal ConfigurationReader(IConfigurationSection configSection, IReadOnlyColle
40
36
_section = configSection ?? throw new ArgumentNullException ( nameof ( configSection ) ) ;
41
37
_configurationAssemblies = configurationAssemblies ?? throw new ArgumentNullException ( nameof ( configurationAssemblies ) ) ;
42
38
_resolutionContext = resolutionContext ?? throw new ArgumentNullException ( nameof ( resolutionContext ) ) ;
43
- #if NETSTANDARD || NET461
44
39
_configurationRoot = resolutionContext . HasAppConfiguration ? resolutionContext . AppConfiguration as IConfigurationRoot : null ;
45
- #endif
46
40
}
47
41
48
42
public void Configure ( LoggerConfiguration loggerConfiguration )
@@ -192,8 +186,6 @@ void ApplyMinimumLevelConfiguration(IConfigurationSection directive, Action<Logg
192
186
193
187
IConfigurationSection GetDefaultMinLevelDirective ( )
194
188
{
195
- #if NETSTANDARD || NET461
196
-
197
189
var defaultLevelDirective = minimumLevelDirective . GetSection ( "Default" ) ;
198
190
if ( _configurationRoot != null && minimumLevelDirective . Value != null && defaultLevelDirective . Value != null )
199
191
{
@@ -213,8 +205,6 @@ IConfigurationSection GetDefaultMinLevelDirective()
213
205
return null ;
214
206
}
215
207
216
- #endif //NET451 or fallback
217
-
218
208
return minimumLevelDirective . Value != null ? minimumLevelDirective : minimumLevelDirective . GetSection ( "Default" ) ;
219
209
}
220
210
}
0 commit comments