Skip to content

Add config overloads to pass both a IConfigSection and IConfiguration #148

@tsimbalar

Description

@tsimbalar

Right now, when calling ReadFrom.ConfigSection(IConfigurationSection configSection), the ConfigurationReader does not have access to the global IConfiguration object, so it cannot access the configuration out of the given section. That makes it impossible to access, say, the ConnectionStrings ... .

In PR #144 we added a check to throw an exception when calling a config method that expects an IConfiguration from the ReadFrom.ConfigSection overload so that users don't shoot themselves in the foot.

We should probably mark ConfigurationSection(this LoggerSettingsConfiguration settingConfiguration /*, ...*/) methods as obsolete and instead provide new overloads like

ReadFrom.ConfigurationSection(
  this LoggerSettingsConfiguration settingConfiguration, 
  IConfiguration configuration, 
  string sectionName /*, ...*/)

this would store the global IConfiguration object and look for a section with a given name within.

Does that seem to make sense ?

See #143 for more details

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions