Skip to content

Inheritable and global placeholders in app.config files.

Notifications You must be signed in to change notification settings

MarioZ/ConfigPoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is a proof-of-concept (POC) for a read-only app.config elements inheritance in a custom configuration section.
Inspired by MSBuild's properties and items placeholders (e.g., $(Platform) and @(Compile) placeholders).

The goal was to achieve reusing of existing configuration properties inside another configuration property; any configuration element should be able to define placeholders in its property's value that would reference its existing properties and/or properties that any of its parent configuration elements have.

For example, consider the following custom configuration section:

<UserSettings Application="MY APP"
              Version="1.0">
  <User FullName="$(FirstName) $(LastName)"
        FirstName="John"
        LastName="Doe"
        WelcomeMessage="Hello $(FullName), welcome to $(Application) v$(Version)!" />
</UserSettings>

The result of WelcomeMessage property is:

Hello John Doe, welcome to MY APP v1.0!

Notes:

  • ☑︎ Added support for inherited values from ConfigurationElement.
  • ☑︎ Added support for inherited values from ConfigurationElementCollection.
  • ☑︎ Added support for inherited values from ConfigurationSection.
  • ☑︎ Added support for global values from appSettings.
  • ☑︎ Added support for Standard and Custom Numeric Format, e.g. $(placeholderName \# #,##0.00).
  • ☑︎ Added support for Standard and Custom Date and Time Format, e.g. $(placeholderName \@ MMMM dd, yyyy).

About

Inheritable and global placeholders in app.config files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages