Class AConfig
Get and set configuration settings, e.g. folder and file names, URLs, system settings (dataflow buffer sizes etc.)
Each worker system uses an AConfig
instance via the Config
property, but it can also be used stand-alone, without any worker system.
See AConfig Configuration Facility and JsonConfigurationService for further details.
Namespace: actionETL.Configuration
Assembly: actionETL.dll
Syntax
public class AConfig
Constructors
AConfig(IConfigurationService)
Initializes a new instance of the AConfig class with the provided IConfigurationService.
Declaration
public AConfig(IConfigurationService configurationService)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationService | configurationService | The configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
Properties
Item[String]
Gets (with InvariantCulture) or sets/updates a global
(i.e. no applyTo
specified) configuration with a string
value.
This is a short-cut for the GetValue<string>
and
SetValue(..., string)
methods. Do use GetValue
/ SetValue
methods instead when retrieving non-string values, and when one of their additional
arguments is needed.
This indexer is thread-safe.
Declaration
public string this[string configurationName] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
Property Value
Type | Description |
---|---|
String | The string value. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type T. |
NotSupportedException | Converting to type T is not supported. |
Methods
GetValue<T>(String)
Gets a global (i.e. no applyTo
specified) configuration value with
InvariantCulture.
This method is thread-safe.
Declaration
public T GetValue<T>(string configurationName)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValue<T>(String, CultureInfo)
Gets a global (i.e. no applyTo
specified) configuration value.
This method is thread-safe.
Declaration
public T GetValue<T>(string configurationName, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
CultureInfo | culture | The culture to use when converting a string to a typed value. Defaults to
InvariantCulture if |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValue<T>(String, String)
Gets a configuration value with InvariantCulture.
This method is thread-safe.
Declaration
public T GetValue<T>(string configurationName, string applyTo)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
String | applyTo | What part of the worker hierarchy the configuration applies to. Use |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValue<T>(String, String, CultureInfo)
Gets a configuration value.
This method is thread-safe.
Declaration
public T GetValue<T>(string configurationName, string applyTo, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. Cannot be |
String | applyTo | What part of the worker hierarchy the configuration applies to. Use |
CultureInfo | culture | The culture to use when converting a string to a typed value. Defaults to
InvariantCulture if |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValueWithDefault<T>(String, T)
Gets a global (i.e. no applyTo
specified) configuration value with
InvariantCulture, or a default value if no configuration found.
This method is thread-safe.
Declaration
public T GetValueWithDefault<T>(string configurationName, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
T | defaultValue | The default value. |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValueWithDefault<T>(String, CultureInfo, T)
Gets a global (i.e. no applyTo
specified) configuration value, or a
default value if no configuration found.
This method is thread-safe.
Declaration
public T GetValueWithDefault<T>(string configurationName, CultureInfo culture, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
CultureInfo | culture | The culture to use when converting a string to a typed value. Defaults to
InvariantCulture if |
T | defaultValue | The default value. |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValueWithDefault<T>(String, String, T)
Gets a configuration value with InvariantCulture, or a default value if no configuration found.
This method is thread-safe.
Declaration
public T GetValueWithDefault<T>(string configurationName, string applyTo, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
String | applyTo | What part of the worker hierarchy the configuration applies to. Use |
T | defaultValue | The default value. |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
GetValueWithDefault<T>(String, String, CultureInfo, T)
Gets a configuration value, or a default value if no configuration found.
This method is thread-safe.
Declaration
public T GetValueWithDefault<T>(string configurationName, string applyTo, CultureInfo culture, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
String | applyTo | What part of the worker hierarchy the configuration applies to. Use |
CultureInfo | culture | The culture to use when converting a string to a typed value. Defaults to
InvariantCulture if |
T | defaultValue | The default value. |
Returns
Type | Description |
---|---|
T | The typed value. |
Type Parameters
Name | Description |
---|---|
T | The target value type. See TryGetValue<T>(String, String, CultureInfo) for types supported by the default configuration service. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
FormatException | Parse error converting configuration to type |
NotSupportedException | Converting to type |
SetValue(String, Int64)
Creates or updates a global (i.e. no applyTo
specified) configuration value.
This method is thread-safe.
Declaration
public AConfig SetValue(string configurationName, long valueInt64)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
Int64 | valueInt64 | The value as an integer. |
Returns
Type | Description |
---|---|
AConfig | The |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
InvalidOperationException | Cannot set this configuration after creating the worker system. Instead create and inject the configuration service explicitly, please see the documentation. |
SetValue(String, String)
Creates or updates a global (i.e. no applyTo
specified) configuration value.
This method is thread-safe.
Declaration
public AConfig SetValue(string configurationName, string valueString)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
String | valueString | The value as a string. |
Returns
Type | Description |
---|---|
AConfig | The |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
InvalidOperationException | Cannot set this configuration after creating the worker system. Instead create and inject the configuration service explicitly, please see the documentation. |
SetValue(String, String, Int64)
Creates or updates a configuration value.
This method is thread-safe.
Declaration
public AConfig SetValue(string configurationName, string applyTo, long valueInt64)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
String | applyTo | What part of the worker hierarchy this configuration applies to. Use |
Int64 | valueInt64 | The value as an integer. |
Returns
Type | Description |
---|---|
AConfig | The |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
InvalidOperationException | Cannot set this configuration after creating the worker system. Instead create and inject the configuration service explicitly, please see the documentation. |
SetValue(String, String, String)
Creates or updates a configuration value.
This method is thread-safe.
Declaration
public AConfig SetValue(string configurationName, string applyTo, string valueString)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. |
String | applyTo | What part of the worker hierarchy this configuration applies to. Use |
String | valueString | The value as a string. |
Returns
Type | Description |
---|---|
AConfig | The |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
InvalidOperationException | Cannot set this configuration after creating the worker system. Instead create and inject the configuration service explicitly, please see the documentation. |
ToString()
Returns a String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
TryGetValue<T>(String, String, CultureInfo)
Attempts to get a configuration value, returning an IGetValueOutcome
instance describing the outcome. To instead throw an exception on any failure, use the
AConfig GetValue
and GetValueWithDefault
methods.
Where possible, do use the simpler GetValue()
and
GetValueWithDefault()
overloads.
This method is thread-safe.
Declaration
public IGetValueOutcome TryGetValue<T>(string configurationName, string applyTo, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | configurationName | Name of the configuration. Cannot be |
String | applyTo | What part of the worker hierarchy the configuration applies to. Use |
CultureInfo | culture | The culture to use when converting a string to a typed value. Defaults to
InvariantCulture if |
Returns
Type | Description |
---|---|
IGetValueOutcome | The outcome is returned in a class instance derived from IGetValueOutcome:
Typical usage is to call |
Type Parameters
Name | Description |
---|---|
T | The target value type. TryGetValue<T>(String, String, CultureInfo) describes what types the default service supports. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|