You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-8Lines changed: 33 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Version 2 is here with some new features:
19
19
* Base Optional Tag - The [optional](#optional) tag that some of the builders in this project employed in V1 has been moved into the base class and is now available
20
20
on all key/value config builders.
21
21
* Section Handlers - This feature allows users to develop extensions that will apply key/value config to sections other than `appSettings` and `connectionStrings`
22
-
if desired. Read more about this feature in the [Section Handlers](#sectionhandlers) segment below.
22
+
if desired. Read more about this feature in the [Section Handlers](#section-handlers) segment below.
23
23
24
24
## Key/Value Config Builders
25
25
@@ -69,6 +69,13 @@ key name before being inserted into AppSettings. `stripPrefix` is a boolean valu
69
69
This setting is a boolean that specified whether to avoid throwing exceptions when the backing configuration source cannot be found or connected.
70
70
The default default value is `true`, though some config builders (such as the Azure-based builders) will use a different default.
71
71
72
+
#### escapeExpandedValues
73
+
.Net configuration is XML-based in it's raw form. While these config builders work on `ConfigurationSection` objects in `Strict` and `Greedy` modes,
74
+
when operating in `Expand` mode, tokens in the raw XML input are directly replaced with values. Applications that use `Expand` mode may do so because
75
+
they need to inject additional XML rather than just a string value. But for the cases when a simple string replacement is the goal, unescaped XML
76
+
characters in replacement values may result in invalid XML. In these cases, simply set the `escapeExpandedValues` attribute to `true` and the
77
+
config builder will escape special XML characters before replacing tokens in `Expand` mode. The default value is `false`.
78
+
72
79
#### tokenPattern
73
80
This is a setting that is shared between all KeyValueConfigBuilder-derived builders is `tokenPattern`. When describing the `Expand` behavior of these builders
74
81
above, it was mentioned that the raw xml is searched for tokens that look like __`${token}`__. This is done with a regular expression. `@"\$\{(\w+)\}"` to be exact.
When adding additional handlers, the name of the section must be 'Microsoft.Configuration.ConfigurationBuilders.SectionHandlers' so key/value config builders can find it.
349
+
When adding additional handlers, the name of this section must be 'Microsoft.Configuration.ConfigurationBuilders.SectionHandlers' so key/value config builders can find it.
350
+
Also note that a more qualified type will be required so the runtime can determine which assembly contains the new handler type. When working
351
+
with ASP.Net applications, it is hit and miss regarding whether its able to define new section handlers in `App_Code` or not. Some configuration
352
+
sections (such as `appSettings`) get loaded by ASP.Net before `App_Code` is compiled, so handlers for those sections will need to be
353
+
compiled in a separate assembly in the 'bin' directory. For example:
<!-- key="Secret3" value="Will be added by KV3:Latest3. IFF already added, will be "updated" by KV1 to Latest3. KV2 and KV4 don't have versions matching this secret." -->
0 commit comments