Class ConfigurationExt
Namespace: ArmoniK.Api.Common.Utils
Assembly: ArmoniK.Api.Common.dll
Extends the functionality of the
public static class ConfigurationExt
Inheritance
Inherited Members
object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object, object), object.ToString()
Methods
GetRequiredValue<T>(IConfiguration, string)
Configure an object with the given configuration.
public static T GetRequiredValue<T>(this IConfiguration configuration, string key)
Parameters
configuration IConfiguration
Configurations used to populate the class
key string
Path to the Object in the configuration
Returns
T
The initialized object
Type Parameters
T
Type of the options class
Exceptions
the key is not found in the configurations.
GetTimeSpanOrDefault(IConfiguration, string, TimeSpan)
Retrieves a
public static TimeSpan GetTimeSpanOrDefault(this IConfiguration configuration, string key, TimeSpan defaultValue)
Parameters
configuration IConfiguration
The
key string
The key of the configuration value to retrieve.
defaultValue TimeSpan
The default value to return if the key is not found or the value is invalid.
Returns
A defaultValue if invalid
or missing.
Exceptions
Thrown if the value is not a valid