Table of Contents

Class ResolverStore

Namespace
Invex.Rez.Implementation
Assembly
Invex.Rez.dll

The default implementation of IResolverStore - a mutable IResolverSource whose variables and functions can be added and removed at any time.

[PublicAPI]
public sealed class ResolverStore : IResolverStore, IResolverSource
Inheritance
object
ResolverStore
Implements

Remarks

For an immutable source whose contents are fixed at construction time, use ResolverSource instead.

Methods

AddFunction(string, Func<FunctionCall, string>)

Adds a function to the store.
If a function with the same name already exists, it is replaced.

public void AddFunction(string name, Func<FunctionCall, string> function)

Parameters

name string

The name of the function to add.

function Func<FunctionCall, string>

The function to add.
Note: the function should never return null; instead, return an empty string for a blank result.

Remarks

The braces, parentheses, and arguments that denote a function in a template are not included in the name - for the template {repeat(abc,3)}, the name is "repeat".

AddVariable(string, string)

Adds a variable to the store.
If a variable with the same name already exists, its value is replaced.

public void AddVariable(string name, string value)

Parameters

name string

The name of the variable to add.

value string

The value of the variable to add.
Note: the value should never be null; instead, use an empty string for a blank result.

Remarks

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

RemoveFunction(string)

Removes a function from the store.
If the function was not added, this method does nothing.

public void RemoveFunction(string name)

Parameters

name string

The name of the function to remove.

Remarks

The braces, parentheses, and arguments that denote a function in a template are not included in the name - for the template {repeat(abc,3)}, the name is "repeat".

RemoveVariable(string)

Removes a variable from the store.
If the variable was not added, this method does nothing.

public void RemoveVariable(string name)

Parameters

name string

The name of the variable to remove.

Remarks

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

ResolveFunction(string)

Resolves a function with the given name.

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

Parameters

name string

The name of the function to resolve.

Returns

Func<FunctionCall, string>

A delegate that produces the function's result from a FunctionCall, or null if this source cannot resolve the function.
Returning null allows the next source registered with the IResolver to be queried.

Remarks

The braces, parentheses, and arguments that denote a function in a template are not included in the name - for the template {repeat(abc,3)}, the name is "repeat".

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".