-
Notifications
You must be signed in to change notification settings - Fork 200
Revisit Key behavior #279
Description
@divega wrote:
cc @kirthik, who made the change and touched this line previously. I think this is kind of intentional, but also something we could discuss:
The Key property was added to the IConfigurationSection interface with the intention of providing metadata about the configuration node corresponding to the instance. From that perspective the new behavior provides de most information. With the previous behavior it would have been cumbersome to obtain this information.
Personally I wasn't even aware that there was a Key property hanging there previously. Presumably it was not in the interface but in the class? From that perspective this is a subtle breaking change that even @kirthik missed she had to react to when she previously adjusted this code. It has now became cumbersome to obtain jus the last key segment if that is what you need.
In theory we could expose both, e.g. Key and FullKey. Not sure is a good idea as it makes the API more complicated for everyone. We should really look and the scenarios...
Regardless, it seems that at the minimum we should go back at the places where ConfigurationSection.Key was being used across the stack and make sure we don't leave them broken.
@HaoK wrote:
Could also consder just splitting it into two properties like:
ParentPath and Key, so basically you can just concat the two to get the current full path behavior, and Key is untouched and remains the last segment.