Table of Contents

Class Include

Namespace
BotManager.Runtime.Expressions
Assembly
BotManager.Runtime.dll

Includes and executes an external json config. The included file is only read and parsed once on the first execution.

Returns the value that is returned by the executed file.

This json example executes the expression in the "inc.json" file and returns its value:
{ "$Include": "inc.json" }
[JsonConverter(typeof(IncludeConverter))]
public sealed class Include : IExpression
Inheritance
Include
Implements
Inherited Members

Constructors

Include()

Empty constructor for serialization.

public Include()

Include(string)

Creates an expression includes another json file and runs it.

public Include(string fileName)

Parameters

fileName string

The filename of the json file to execute.

Properties

FileName

Gets and sets the filename of the json file to execute. The file path can be absolute or relative to the root config file.

[JsonRootProperty]
public string FileName { get; set; }

Property Value

string

Methods

ExecuteAsync(RuntimeContext, Type?)

Executes the expression in the given RuntimeContext. Please do not use this method to run an expression. Use ExecuteAsync(IExpression?) instead.

public Task<object?> ExecuteAsync(RuntimeContext context, Type? returnType)

Parameters

context RuntimeContext

The current runtime context.

returnType Type

The expected return type. Use typeof(object) for a generic result. Use null if you don't need the return value.

Returns

Task<object>

Returns the result of the expression.