Interface IFormulaFunctions
An interface of the context object associated with processing all LemonEdge formulas
Namespace: LemonEdge.API.Core.Formulas
Assembly: LemonEdge.API.dll
Syntax
public interface IFormulaFunctions
Properties
Cache
A local cache for retrieving already loaded standing data
Declaration
IReadOnlyCache Cache { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCache |
Data
A context that allows you to retrieve and query any data from the LemonEdge system for evaluation
Declaration
IEntityRetriever Data { get; }
Property Value
| Type | Description |
|---|---|
| IEntityRetriever |
User
The current user running the formula
Declaration
UserInfo User { get; }
Property Value
| Type | Description |
|---|---|
| UserInfo |
Methods
Evaluate<T>(string, bool)
Evaluates the specified formula and returns the result as the specified
T using the IScriptHelper
Declaration
Task<T> Evaluate<T>(string formula, bool compileOnly = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | formula | The formula, or script, to be parsed and evaluated |
| bool | compileOnly | Whether to just compile the script for the purpose of initialisation, or also execute it. |
Returns
| Type | Description |
|---|---|
| Task<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
GetItemPropertyValue(object, string)
Returns the value for a specified propName against an item
Declaration
object GetItemPropertyValue(object item, string propName)
Parameters
| Type | Name | Description |
|---|---|---|
| object | item | The item to return the value of the specified property from |
| string | propName | The property to return the value from |
Returns
| Type | Description |
|---|---|
| object | The value for a specified |
IsValid<T>(string)
Validates the given formula against this context type. Throws an error with any compilation exceptions
Declaration
bool IsValid<T>(string formula)
Parameters
| Type | Name | Description |
|---|---|---|
| string | formula | The formula, or script, to be parsed and evaluated |
Returns
| Type | Description |
|---|---|
| bool |
Type Parameters
| Name | Description |
|---|---|
| T | the would-be return type of the formula or script |
See Also
IsValid<T>(string, Type)
Validates the given formula against the provided contextType. Throws an error with any compilation exceptions
Declaration
bool IsValid<T>(string formula, Type contextType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | formula | The formula, or script, to be parsed and evaluated |
| Type | contextType | The context object that can be referenced by the formula or script |
Returns
| Type | Description |
|---|---|
| bool |
Type Parameters
| Name | Description |
|---|---|
| T | the would-be return type of the formula or script |
See Also
ShareThisQueryCacheWithTarget(IFormulaFunctions)
Declaration
void ShareThisQueryCacheWithTarget(IFormulaFunctions targetContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IFormulaFunctions | targetContext |