Class ConfigurationBuilder
Helper class to load cache manager configurations from file or to build new configurations in a fluent way.
This only loads configurations. To build a cache manager instance, use CacheFactory
and pass in the configuration. Or use the Build methods of CacheFactory!
Inherited Members
Namespace:CacheManager.Core
Assembly:CacheManager.Core.dll
Syntax
public class ConfigurationBuilder : ConfigurationBuilderCachePart
Constructors
| Improve this Doc View SourceConfigurationBuilder()
Initializes a new instance of the ConfigurationBuilder class which provides fluent configuration methods.
Declaration
public ConfigurationBuilder()
ConfigurationBuilder(ICacheManagerConfiguration)
Initializes a new instance of the ConfigurationBuilder class which provides fluent configuration methods. Creates a builder which allows to modify the existing forConfiguration.
Declaration
public ConfigurationBuilder(ICacheManagerConfiguration forConfiguration)
Parameters
| Type | Name | Description |
|---|---|---|
| ICacheManagerConfiguration | forConfiguration | The configuration the builder should be instantiated for. |
ConfigurationBuilder(String)
Initializes a new instance of the ConfigurationBuilder class which provides fluent configuration methods.
Declaration
public ConfigurationBuilder(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The name of the cache manager. |
ConfigurationBuilder(String, ICacheManagerConfiguration)
Initializes a new instance of the ConfigurationBuilder class which provides fluent configuration methods. Creates a builder which allows to modify the existing forConfiguration.
Declaration
public ConfigurationBuilder(string name, ICacheManagerConfiguration forConfiguration)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The name of the cache manager. |
| ICacheManagerConfiguration | forConfiguration | The configuration the builder should be instantiated for. |
Methods
| Improve this Doc View SourceBuildConfiguration(Action<ConfigurationBuilderCachePart>)
Builds a CacheManagerConfiguration which can be used to create a new cache manager instance.
Pass the configuration to FromConfiguration<TCacheValue>(ICacheManagerConfiguration) to create a valid cache manager.
Declaration
public static ICacheManagerConfiguration BuildConfiguration(Action<ConfigurationBuilderCachePart> settings)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<ConfigurationBuilderCachePart> | settings | The configuration settings to define the cache handles and other properties. |
Returns
| Type | Description |
|---|---|
| ICacheManagerConfiguration |
BuildConfiguration(String, Action<ConfigurationBuilderCachePart>)
Builds a CacheManagerConfiguration which can be used to create a new cache manager instance.
Pass the configuration to FromConfiguration<TCacheValue>(ICacheManagerConfiguration) to create a valid cache manager.
Declaration
public static ICacheManagerConfiguration BuildConfiguration(string name, Action<ConfigurationBuilderCachePart> settings)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The name of the cache manager. |
| Action<ConfigurationBuilderCachePart> | settings | The configuration settings to define the cache handles and other properties. |
Returns
| Type | Description |
|---|---|
| ICacheManagerConfiguration |
LoadConfiguration(String)
Loads a configuration from web.config or app.config.
The configName must match with the name attribute of one of the configured cache elements.
Declaration
public static ICacheManagerConfiguration LoadConfiguration(string configName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configName | The name of the cache element within the config file. |
Returns
| Type | Description |
|---|---|
| ICacheManagerConfiguration | The |
LoadConfiguration(String, String)
Loads a configuration from web.config or app.config, by section and config name.
The configName must match with the name attribute of one of the configured cache elements.
Declaration
public static ICacheManagerConfiguration LoadConfiguration(string sectionName, string configName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | sectionName | The name of the section. |
| String | configName | The name of the cache element within the config file. |
Returns
| Type | Description |
|---|---|
| ICacheManagerConfiguration | The |
LoadConfigurationFile(String, String)
Loads a configuration from the given configFileName.
The configName must match with the name attribute of one of the configured cache elements.
Declaration
public static ICacheManagerConfiguration LoadConfigurationFile(string configFileName, string configName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configFileName | The full path of the file to load the configuration from. |
| String | configName | The name of the cache element within the config file. |
Returns
| Type | Description |
|---|---|
| ICacheManagerConfiguration | The |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If configFileName or configName are null. |
| InvalidOperationException | If the file specified by configFileName does not exist. |
LoadConfigurationFile(String, String, String)
Loads a configuration from the given configFileName and sectionName.
The configName must match with the name attribute of one of the configured cache elements.
Declaration
public static ICacheManagerConfiguration LoadConfigurationFile(string configFileName, string sectionName, string configName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configFileName | The full path of the file to load the configuration from. |
| String | sectionName | The name of the configuration section. |
| String | configName | The name of the cache element within the config file. |
Returns
| Type | Description |
|---|---|
| ICacheManagerConfiguration | The |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If configFileName or configName are null. |
| InvalidOperationException | If the file specified by configFileName does not exist. |