-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #438 from serilog/dev
8.0.3 Release
- Loading branch information
Showing
10 changed files
with
323 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationArgumentValue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Reflection; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Serilog.Settings.Configuration; | ||
|
||
abstract class ConfigurationArgumentValue | ||
{ | ||
public abstract object? ConvertTo(Type toType, ResolutionContext resolutionContext); | ||
|
||
public static ConfigurationArgumentValue FromSection(IConfigurationSection argumentSection, IReadOnlyCollection<Assembly> configurationAssemblies) | ||
{ | ||
ConfigurationArgumentValue argumentValue; | ||
|
||
// Reject configurations where an element has both scalar and complex | ||
// values as a result of reading multiple configuration sources. | ||
if (argumentSection.Value != null && argumentSection.GetChildren().Any()) | ||
throw new InvalidOperationException( | ||
$"The value for the argument '{argumentSection.Path}' is assigned different value " + | ||
"types in more than one configuration source. Ensure all configurations consistently " + | ||
"use either a scalar (int, string, boolean) or a complex (array, section, list, " + | ||
"POCO, etc.) type for this argument value."); | ||
|
||
if (argumentSection.Value != null) | ||
{ | ||
argumentValue = new StringArgumentValue(argumentSection.Value); | ||
} | ||
else | ||
{ | ||
argumentValue = new ObjectArgumentValue(argumentSection, configurationAssemblies); | ||
} | ||
|
||
return argumentValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/Serilog.Settings.Configuration/Settings/Configuration/IConfigurationArgumentValue.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.