Table of Contents

Class ConfigResolverSource

Namespace
Invex.Rez.Configuration
Assembly
Invex.Rez.Configuration.dll

An IResolverSource that resolves variables from an Microsoft.Extensions.Configuration.IConfigurationRoot.
Functions are not supported by this source.

[PublicAPI]
public sealed class ConfigResolverSource : IResolverSource
Inheritance
object
ConfigResolverSource
Implements

Constructors

ConfigResolverSource(IConfigurationRoot)

Creates a new ConfigResolverSource with the given Microsoft.Extensions.Configuration.IConfigurationRoot.

public ConfigResolverSource(IConfigurationRoot configuration)

Parameters

configuration IConfigurationRoot

The Microsoft.Extensions.Configuration.IConfigurationRoot to resolve variables from.
Nested configuration keys (e.g., "Section": { "Key": ... }) are addressed using the standard colon-delimited form (e.g., {Section:Key}).

Exceptions

ArgumentNullException

Thrown if configuration is null.

Methods

ResolveFunction(string)

Always returns null - functions are not supported by this source.

public Func<FunctionCall, string>? ResolveFunction(string name)

Parameters

name string

The name of the function to resolve.

Returns

Func<FunctionCall, string>

null.

ResolveVariable(string)

Resolves a variable with the given name.

public string? ResolveVariable(string name)

Parameters

name string

The name of the variable to resolve.

Returns

string

The value of the variable, or null if this source cannot resolve the variable.
Returning null allows the next source registered with the IResolver to be queried.

Remarks

The braces that denote a variable in a template are not included in the name - for the template {color}, the name is "color".