Class ConfigurationExtensions
Extensions for 
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class ConfigurationExtensionsMethods
View SourceGetConnectionStringProviderName(IConfiguration, String)
Gets the provider name for the connection string name (shorthand for GetSection("ConnectionStrings")[name + "_ProviderName"]).
Declaration
public static string GetConnectionStringProviderName(this IConfiguration configuration, string name)Parameters
| Type | Name | Description | 
|---|---|---|
| IConfiguration | configuration | The configuration. | 
| System.String | name | The connection string key. | 
Returns
| Type | Description | 
|---|---|
| System.String | The provider name. | 
Remarks
This uses the same convention as the Configuration API for connection string environment variables.
GetModelsMode(IConfiguration)
Declaration
public static ModelsMode GetModelsMode(this IConfiguration configuration)Parameters
| Type | Name | Description | 
|---|---|---|
| IConfiguration | configuration | 
Returns
| Type | Description | 
|---|---|
| ModelsMode | 
GetRuntimeMode(IConfiguration)
Gets the Umbraco runtime mode.
Declaration
public static RuntimeMode GetRuntimeMode(this IConfiguration configuration)Parameters
| Type | Name | Description | 
|---|---|---|
| IConfiguration | configuration | The configuration. | 
Returns
| Type | Description | 
|---|---|
| RuntimeMode | The Umbraco runtime mode. | 
GetUmbracoConnectionString(IConfiguration, String)
Gets the Umbraco connection string (shorthand for GetSection("ConnectionStrings")[name] and replacing the |DataDirectory| placeholder).
Declaration
public static string GetUmbracoConnectionString(this IConfiguration configuration, string name = "umbracoDbDSN")Parameters
| Type | Name | Description | 
|---|---|---|
| IConfiguration | configuration | The configuration. | 
| System.String | name | The connection string key. | 
Returns
| Type | Description | 
|---|---|
| System.String | The Umbraco connection string. | 
GetUmbracoConnectionString(IConfiguration, String, out String)
Gets the Umbraco connection string and provider name (shorthand for GetSection("ConnectionStrings")[name] and replacing the |DataDirectory| placeholder).
Declaration
public static string GetUmbracoConnectionString(this IConfiguration configuration, string name, out string providerName)Parameters
| Type | Name | Description | 
|---|---|---|
| IConfiguration | configuration | The configuration. | 
| System.String | name | The name. | 
| System.String | providerName | The provider name. | 
Returns
| Type | Description | 
|---|---|
| System.String | The Umbraco connection string. | 
GetUmbracoConnectionString(IConfiguration, out String)
Gets the Umbraco connection string and provider name (shorthand for GetSection("ConnectionStrings")[Constants.System.UmbracoConnectionName] and replacing the |DataDirectory| placeholder).
Declaration
public static string GetUmbracoConnectionString(this IConfiguration configuration, out string providerName)Parameters
| Type | Name | Description | 
|---|---|---|
| IConfiguration | configuration | The configuration. | 
| System.String | providerName | The provider name. | 
Returns
| Type | Description | 
|---|---|
| System.String | The Umbraco connection string. |