-
Notifications
You must be signed in to change notification settings - Fork 201
Conversation
This is a breaking change right? |
I guess so, we can go back to the business of adding a bool flag to opt into this new 'stripPrefix' behavior |
configurationBuilder.Add(memConfigSrc3); | ||
|
||
var config = configurationBuilder.Build(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add // Assert
comment
Not against having a bool parameter on |
Updated, adding removePathFromChildKeys to opt into the new behavior, added a few more tests verifying that the value is not shown for children, and also empty keys are supported |
Also added a test to confirm that this flag does nothing when called on the root (since it has no path) |
{ | ||
var stack = new Stack<IConfiguration>(); | ||
stack.Push(configuration); | ||
var rootSection = configuration as IConfigurationSection; | ||
var prefixLength = (removePathFromChildKeys && rootSection != null) ? rootSection.Path.Length + 1 : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this code is kind of ugly, if we represented the Root as simply having a null/empty path with the property on IConfiguration, we wouldn't have to always do this cast to IConfigurationSection every time we do traversal code on config looking for a Path...
Fixes #473
@divega