UserSecretsConfigurationExtensions.AddUserSecrets Method

Definition

Overloads

AddUserSecrets(IConfigurationBuilder, Assembly)

Adds the user secrets configuration source. This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets(IConfigurationBuilder, String)

Adds the user secrets configuration source with specified user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets(IConfigurationBuilder, Assembly, Boolean)

Adds the user secrets configuration source. This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets(IConfigurationBuilder, String, Boolean)

Adds the user secrets configuration source with specified user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets(IConfigurationBuilder, Assembly, Boolean, Boolean)

Adds the user secrets configuration source. This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets<T>(IConfigurationBuilder)

Adds the user secrets configuration source. Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets<T>(IConfigurationBuilder, Boolean)

Adds the user secrets configuration source. Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets<T>(IConfigurationBuilder, Boolean, Boolean)

Adds the user secrets configuration source. Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets(IConfigurationBuilder, Assembly)

Adds the user secrets configuration source. This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, System::Reflection::Assembly ^ assembly);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, System.Reflection.Assembly assembly);
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * System.Reflection.Assembly -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddUserSecrets (configuration As IConfigurationBuilder, assembly As Assembly) As IConfigurationBuilder

Parameters

configuration
IConfigurationBuilder

The configuration builder.

assembly
Assembly

The assembly with the UserSecretsIdAttribute.

Returns

IConfigurationBuilder

The configuration builder.

Exceptions

Thrown when assembly does not have a valid UserSecretsIdAttribute

AddUserSecrets(IConfigurationBuilder, String)

Adds the user secrets configuration source with specified user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, System::String ^ userSecretsId);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, string userSecretsId);
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * string -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddUserSecrets (configuration As IConfigurationBuilder, userSecretsId As String) As IConfigurationBuilder

Parameters

configuration
IConfigurationBuilder

The configuration builder.

userSecretsId
String

The user secrets ID.

Returns

IConfigurationBuilder

The configuration builder.

AddUserSecrets(IConfigurationBuilder, Assembly, Boolean)

Adds the user secrets configuration source. This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, System::Reflection::Assembly ^ assembly, bool optional);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, System.Reflection.Assembly assembly, bool optional);
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * System.Reflection.Assembly * bool -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddUserSecrets (configuration As IConfigurationBuilder, assembly As Assembly, optional As Boolean) As IConfigurationBuilder

Parameters

configuration
IConfigurationBuilder

The configuration builder.

assembly
Assembly

The assembly with the UserSecretsIdAttribute.

optional
Boolean

Whether loading secrets is optional. When false, this method may throw.

Returns

IConfigurationBuilder

The configuration builder.

Exceptions

Thrown when optional is false and assembly does not have a valid UserSecretsIdAttribute.

AddUserSecrets(IConfigurationBuilder, String, Boolean)

Adds the user secrets configuration source with specified user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, System::String ^ userSecretsId, bool reloadOnChange);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, string userSecretsId, bool reloadOnChange);
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * string * bool -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddUserSecrets (configuration As IConfigurationBuilder, userSecretsId As String, reloadOnChange As Boolean) As IConfigurationBuilder

Parameters

configuration
IConfigurationBuilder

The configuration builder.

userSecretsId
String

The user secrets ID.

reloadOnChange
Boolean

Whether the configuration should be reloaded if the file changes.

Returns

IConfigurationBuilder

The configuration builder.

AddUserSecrets(IConfigurationBuilder, Assembly, Boolean, Boolean)

Adds the user secrets configuration source. This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, System::Reflection::Assembly ^ assembly, bool optional, bool reloadOnChange);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, System.Reflection.Assembly assembly, bool optional, bool reloadOnChange);
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * System.Reflection.Assembly * bool * bool -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddUserSecrets (configuration As IConfigurationBuilder, assembly As Assembly, optional As Boolean, reloadOnChange As Boolean) As IConfigurationBuilder

Parameters

configuration
IConfigurationBuilder

The configuration builder.

assembly
Assembly

The assembly with the UserSecretsIdAttribute.

optional
Boolean

Whether loading secrets is optional. When false, this method may throw.

reloadOnChange
Boolean

Whether the configuration should be reloaded if the file changes.

Returns

IConfigurationBuilder

The configuration builder.

Exceptions

Thrown when optional is false and assembly does not have a valid UserSecretsIdAttribute.

AddUserSecrets<T>(IConfigurationBuilder)

Adds the user secrets configuration source. Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
generic <typename T>
 where T : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets<T> (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration) where T : class;
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder -> Microsoft.Extensions.Configuration.IConfigurationBuilder (requires 'T : null)
<Extension()>
Public Function AddUserSecrets(Of T As Class) (configuration As IConfigurationBuilder) As IConfigurationBuilder

Type Parameters

T

The type from the assembly to search for an instance of UserSecretsIdAttribute.

Parameters

configuration
IConfigurationBuilder

The configuration builder.

Returns

IConfigurationBuilder

The configuration builder.

Exceptions

Thrown when the assembly containing T does not have UserSecretsIdAttribute.

AddUserSecrets<T>(IConfigurationBuilder, Boolean)

Adds the user secrets configuration source. Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
generic <typename T>
 where T : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, bool optional);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets<T> (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, bool optional) where T : class;
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * bool -> Microsoft.Extensions.Configuration.IConfigurationBuilder (requires 'T : null)
<Extension()>
Public Function AddUserSecrets(Of T As Class) (configuration As IConfigurationBuilder, optional As Boolean) As IConfigurationBuilder

Type Parameters

T

The type from the assembly to search for an instance of UserSecretsIdAttribute.

Parameters

configuration
IConfigurationBuilder

The configuration builder.

optional
Boolean

Whether loading secrets is optional. When false, this method may throw.

Returns

IConfigurationBuilder

The configuration builder.

Exceptions

Thrown when optional is false and the assembly containing T does not have a valid UserSecretsIdAttribute.

AddUserSecrets<T>(IConfigurationBuilder, Boolean, Boolean)

Adds the user secrets configuration source. Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

A user secrets ID is unique value used to store and identify a collection of secret configuration values.

public:
generic <typename T>
 where T : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddUserSecrets(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configuration, bool optional, bool reloadOnChange);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddUserSecrets<T> (this Microsoft.Extensions.Configuration.IConfigurationBuilder configuration, bool optional, bool reloadOnChange) where T : class;
static member AddUserSecrets : Microsoft.Extensions.Configuration.IConfigurationBuilder * bool * bool -> Microsoft.Extensions.Configuration.IConfigurationBuilder (requires 'T : null)
<Extension()>
Public Function AddUserSecrets(Of T As Class) (configuration As IConfigurationBuilder, optional As Boolean, reloadOnChange As Boolean) As IConfigurationBuilder

Type Parameters

T

The type from the assembly to search for an instance of UserSecretsIdAttribute.

Parameters

configuration
IConfigurationBuilder

The configuration builder.

optional
Boolean

Whether loading secrets is optional. When false, this method may throw.

reloadOnChange
Boolean

Whether the configuration should be reloaded if the file changes.

Returns

IConfigurationBuilder

The configuration builder.

Exceptions

Thrown when optional is false and the assembly containing T does not have a valid UserSecretsIdAttribute.

Applies to