Class FormulaFunctionsWithContext
The context supplied while executing formulas that also has a custom context item the formula can execute against
Inheritance
Inherited Members
Namespace: LemonEdge.Core
Assembly: API.dll
Syntax
public class FormulaFunctionsWithContext : FormulaFunctions, IFormulaFunctionsWithContextItem, IFormulaFunctions
Constructors
FormulaFunctionsWithContext(IEntityRetriever, IReadOnlyCache, UserInfo, Object)
Creates a new formula functions for helping with custom formulas as a context to operate against
Declaration
public FormulaFunctionsWithContext(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user, object item)
Parameters
Type | Name | Description |
---|---|---|
IEntityRetriever | retriever | A context allowing formulas to load and query any data from LemonEdge |
IReadOnlyCache | cache | A local cache |
UserInfo | user | The current user executing the formula |
System.Object | item | The custom item to be used against the formula |
Properties
Item
The context item the system is running this formula with
Declaration
public IBaseEntity Item { get; }
Property Value
Type | Description |
---|---|
IBaseEntity |
Methods
Create(IEntityRetriever, IReadOnlyCache, UserInfo, Object)
Creates a new FormulaFunctionsWithContext<T> typed correctly to the type of item
to be used as a context against this formula
Declaration
public static (Type ContextType, FormulaFunctionsWithContext ContextInstance) Create(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user, object item)
Parameters
Type | Name | Description |
---|---|---|
IEntityRetriever | retriever | A context allowing formulas to load and query any data from LemonEdge |
IReadOnlyCache | cache | A local cache |
UserInfo | user | The current user executing the formula |
System.Object | item | The custom item to be used against the formula |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Type, FormulaFunctionsWithContext> | A tuple containing the FormulaFunctionsWithContext and the precise type definition of the context item so it can be parsed and evaluated correctly against formula code referencing MyItem |
GetContextType(EntityDescriptor)
Returns the exact type of the FormulaFunctionsWithContext that would be created for working against this type of entity, so the the context item can be parsed and evaluated correctly against formula code referencing MyItem
Declaration
public static Type GetContextType(EntityDescriptor desc)
Parameters
Type | Name | Description |
---|---|---|
EntityDescriptor | desc | The type of entity a formula will be running against |
Returns
Type | Description |
---|---|
System.Type | The exact type of the FormulaFunctionsWithContext that would be created for working against this type of entity, so the the context item can be parsed and evaluated correctly against formula code referencing MyItem |
GetValue(String)
Returns the value of the specified property
If this is against the item, it is just the value of the property against the item.
If this is against a query result, the property name is the column name of the value to returnDeclaration
public virtual object GetValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property to return from the item, or the column name of a sql wrapper result |
Returns
Type | Description |
---|---|
System.Object | The value of the specified property |
GetValue<T>(String)
Declaration
public virtual T GetValue<T>(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
ItemAs<T>()
The context item the system is running this formula with
Declaration
public T ItemAs<T>()
Returns
Type | Description |
---|---|
T | The context item the system is running this formula with |
Type Parameters
Name | Description |
---|---|
T | The type of this context item |