-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
ConfigurationBuilder.xml
130 lines (120 loc) · 9.06 KB
/
ConfigurationBuilder.xml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<Type Name="ConfigurationBuilder" FullName="System.Configuration.ConfigurationBuilder">
<TypeSignature Language="C#" Value="public abstract class ConfigurationBuilder : System.Configuration.Provider.ProviderBase" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit ConfigurationBuilder extends System.Configuration.Provider.ProviderBase" />
<TypeSignature Language="DocId" Value="T:System.Configuration.ConfigurationBuilder" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class ConfigurationBuilder
Inherits ProviderBase" />
<TypeSignature Language="F#" Value="type ConfigurationBuilder = class
 inherit ProviderBase" />
<TypeSignature Language="C++ CLI" Value="public ref class ConfigurationBuilder abstract : System::Configuration::Provider::ProviderBase" />
<AssemblyInfo>
<AssemblyName>System.Configuration</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Configuration.Provider.ProviderBase</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Represents the base class to be extended by custom configuration builder implementations.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Derive from this class to read configuration from an external source that you would like to consume in your .NET Framework application using the standard <xref:System.Configuration.ConfigurationManager> API. ConfigurationBuilders are available on NuGet.org to read from environment variables, Azure key vault, and a number of other sources.
Several implementations of ConfigurationBuilders are available from NuGet.org:
- [EnvironmentConfigBuilder](https://www.nuget.org/packages/Microsoft.Configuration.ConfigurationBuilders.Environment/) - Read from environment variables.
- [AzureKeyVaultConfigBuilder](https://www.nuget.org/packages/Microsoft.Configuration.ConfigurationBuilders.Azure/) - Read from Azure Key Vault.
- [UserSecretsConfigBuilder](https://www.nuget.org/packages/Microsoft.Configuration.ConfigurationBuilders.UserSecrets/) - Read from a usersecrets file on disk, similar to the ASP.NET Core functionality.
- [SimpleJsonConfigBuilder](https://www.nuget.org/packages/Microsoft.Configuration.ConfigurationBuilders.Json/) - Read from a JSON file.
## Examples
The following example shows how to implement a simple ConfigurationBuilder to read Environment variables:
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Configuration.ConfigurationBuilder/CS/SampleConfigurationBuilder.cs":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ConfigurationBuilder/vb/SampleConfigurationBuilder.vb":::
The following example is an excerpt of the configuration file as it applies to the previous example. This applies environment variables to the appSettings configuration
and makes those values available under <xref:System.Configuration.ConfigurationManager.AppSettings?displayProperty=nameWithType>.
```xml
<!-- To declare and use Configuration Builders in your configuration chain, update your app.config or web.config file as follows: -->
<configSections>
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false"/>
</configSections>
<configBuilders>
<builders>
<add name="SampleConfigurationBuilder" type="CustomConfigBuilders.MyConfigBuilder, CustomConfigBuilders" />
</builders>
</configBuilders>
<!-- To apply Configuration Builders to a configuration section, use the 'configBuilders' tag as follows: -->
<appSettings configBuilders="SampleConfigurationBuilder">
<add key="COMPUTERNAME" value="Will Be Replaced by EnvironmentVariable" />
</appSettings>
```
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected ConfigurationBuilder ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Configuration.ConfigurationBuilder.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:
 ConfigurationBuilder();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Configuration</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Configuration.ConfigurationBuilder" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ProcessConfigurationSection">
<MemberSignature Language="C#" Value="public virtual System.Configuration.ConfigurationSection ProcessConfigurationSection (System.Configuration.ConfigurationSection configSection);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Configuration.ConfigurationSection ProcessConfigurationSection(class System.Configuration.ConfigurationSection configSection) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Configuration.ConfigurationBuilder.ProcessConfigurationSection(System.Configuration.ConfigurationSection)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ProcessConfigurationSection (configSection As ConfigurationSection) As ConfigurationSection" />
<MemberSignature Language="F#" Value="abstract member ProcessConfigurationSection : System.Configuration.ConfigurationSection -> System.Configuration.ConfigurationSection
override this.ProcessConfigurationSection : System.Configuration.ConfigurationSection -> System.Configuration.ConfigurationSection" Usage="configurationBuilder.ProcessConfigurationSection configSection" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Configuration::ConfigurationSection ^ ProcessConfigurationSection(System::Configuration::ConfigurationSection ^ configSection);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Configuration</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Configuration.ConfigurationSection</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="configSection" Type="System.Configuration.ConfigurationSection" />
</Parameters>
<Docs>
<param name="configSection">The <see cref="T:System.Configuration.ConfigurationSection" /> to process.</param>
<summary>Accepts a <see cref="T:System.Configuration.ConfigurationSection" /> object from the configuration system and returns a modified or new <see cref="T:System.Configuration.ConfigurationSection" /> object for further use.</summary>
<returns>The processed <see cref="T:System.Configuration.ConfigurationSection" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ProcessRawXml">
<MemberSignature Language="C#" Value="public virtual System.Xml.XmlNode ProcessRawXml (System.Xml.XmlNode rawXml);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Xml.XmlNode ProcessRawXml(class System.Xml.XmlNode rawXml) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Configuration.ConfigurationBuilder.ProcessRawXml(System.Xml.XmlNode)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ProcessRawXml (rawXml As XmlNode) As XmlNode" />
<MemberSignature Language="F#" Value="abstract member ProcessRawXml : System.Xml.XmlNode -> System.Xml.XmlNode
override this.ProcessRawXml : System.Xml.XmlNode -> System.Xml.XmlNode" Usage="configurationBuilder.ProcessRawXml rawXml" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Xml::XmlNode ^ ProcessRawXml(System::Xml::XmlNode ^ rawXml);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Configuration</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.XmlNode</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rawXml" Type="System.Xml.XmlNode" />
</Parameters>
<Docs>
<param name="rawXml">The <see cref="T:System.Xml.XmlNode" /> to process.</param>
<summary>Accepts an <see cref="T:System.Xml.XmlNode" /> representing the raw configuration section from a config file and returns a modified or new <see cref="T:System.Xml.XmlNode" /> for further use.</summary>
<returns>The processed <see cref="T:System.Xml.XmlNode" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>