Class ConfigUtility
Provides configuration utilities.
Inheritance
System.Object
ConfigUtility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Celerik.NetCore.Services
Assembly: cs.temp.dll.dll
Syntax
public static class ConfigUtility
Methods
ReadEnum<TEnum>(IConfiguration, String)
Reads an enumeration from this configuration based on the enum description.
Declaration
public static TEnum ReadEnum<TEnum>(this IConfiguration config, string key)
where TEnum : struct, IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration | config | Reference to the current IConfiguration instance. |
| System.String | key | The key of the configuration section. |
Returns
| Type | Description |
|---|---|
| TEnum | Enum value. |
Type Parameters
| Name | Description |
|---|---|
| TEnum | Enum type. |
Exceptions
| Type | Condition |
|---|---|
| ConfigException | Key not found or value is invalid. |
ReadObject<TObject>(IConfiguration, String)
Reads an object from this configuration by matching property names against configuration keys recursively.
Declaration
public static TObject ReadObject<TObject>(this IConfiguration config, string key)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration | config | Reference to the current IConfiguration instance. |
| System.String | key | The key of the configuration section. |
Returns
| Type | Description |
|---|---|
| TObject | Instance of type T. |
Type Parameters
| Name | Description |
|---|---|
| TObject | The type of the object to be created. |
Exceptions
| Type | Condition |
|---|---|
| ConfigException | Key not found. |