-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathApp.config
78 lines (68 loc) · 5.5 KB
/
App.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
<section name="Microsoft.Configuration.ConfigurationBuilders.SectionHandlers" type="Microsoft.Configuration.ConfigurationBuilders.SectionHandlersSection, Microsoft.Configuration.ConfigurationBuilders.Base" restartOnExternalChanges="false" requirePermission="false" />
<section name="customSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
<section name="expandedSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SampleConsoleApp.ClientSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<configBuilders>
<builders>
<add name="Env" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
<add name="KeyPerFile" mode="Greedy" directoryPath="${SampleItems}/KeyPerFileRoot" type="Microsoft.Configuration.ConfigurationBuilders.KeyPerFileConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.KeyPerFile" />
<add name="Json" mode="Greedy" jsonMode="Flat" jsonFile="${jsonFile}" type="Microsoft.Configuration.ConfigurationBuilders.SimpleJsonConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Json" />
<add name="JsonCS" mode="Strict" jsonMode="Sectional" jsonFile="${jsonFile}" type="Microsoft.Configuration.ConfigurationBuilders.SimpleJsonConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Json" />
<add name="JsonExpand" mode="Token" jsonMode="Sectional" jsonFile="${jsonFile}" type="SamplesLib.ExpandWrapper`1[[Microsoft.Configuration.ConfigurationBuilders.SimpleJsonConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Json]], SamplesLib" />
<add name="DefaultEnv" mode="Token" tokenPattern="\$\{(\w[\w-_$@#+,.~]*)(?:\:([^}]*))?\}" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
</builders>
</configBuilders>
<Microsoft.Configuration.ConfigurationBuilders.SectionHandlers>
<handlers>
<remove name="DefaultConnectionStringsHandler" />
<add name="NewConnectionStringsHandler" type="Microsoft.Configuration.ConfigurationBuilders.ConnectionStringsSectionHandler2, Microsoft.Configuration.ConfigurationBuilders.Base" />
<add name="ClientSettingsHandler" type="SamplesLib.ClientSettingsSectionHandler, SamplesLib" />
</handlers>
</Microsoft.Configuration.ConfigurationBuilders.SectionHandlers>
<appSettings configBuilders="Env,KeyPerFile,DefaultEnv">
<add key="SampleItems" value="~/../../../SampleItems" />
<add key="jsonFile" value="~/../../../SampleWebApp/App_Data/settings.json" />
<add key="TestingEnvDefaults1" value="${WINDIR:Should not see default.}" />
<add key="TestingEnvDefaults2" value="${ENV_VAR_DOES_NOT_EXIST:But a default value is here.}" />
<add key="TestingEnvDefaults3" value="${EMPTY_DEFAULT_VALUE:}" />
<add key="TestingEnvDefaults-DefaultValueNotRequiredWithThisPattern" value="${OS}" />
</appSettings>
<connectionStrings configBuilders="JsonCS">
<add name="simpleCS" connectionString="A Simple Connection String" providerName="A Simple Provider Name" />
<add name="noProvider" connectionString="A Connection String with no providerName" />
<add name="jsonConnectionString1" connectionString="" />
<!-- In Strict/Greedy mode, this advanced example updates both attributes as expected. -->
<!-- In Token mode however, note that only the 'tagged' token works (and it is applied to the wrong attribute here for clear demonstration)
because there is no 'jsonAdvConnStr' config value. If there was, the 'connectionString' attribute would be updated in addition
to 'providerName.'-->
<add name="jsonAdvConnStr" connectionString="${jsonAdvConnStr}" providerName="${jsonAdvConnStr:connectionString}"/>
</connectionStrings>
<customSettings configBuilders="Json" />
<expandedSettings configBuilders="JsonExpand">
${expandedSetting1}
${expandedSetting2}
</expandedSettings>
<applicationSettings>
<SampleConsoleApp.ClientSettings configBuilders="Env">
<setting name="FirstTestSetting" serializeAs="String">
<value>First test of applicationSettings.</value>
</setting>
<setting name="WINDIR" serializeAs="String">
<value>Will be replaced by Environment.</value>
</setting>
<setting name="proCEssOR_archITECture" serializeAs="String">
<value>Will be replaced by Environment.</value>
</setting>
</SampleConsoleApp.ClientSettings>
</applicationSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
</configuration>