Class TriggerContext
The context class that holds all the changes that triggered a IActionTriggerGate
Inheritance
Inherited Members
Namespace: LemonEdge.API.Core.Tasks.Parameters.Triggers
Assembly: LemonEdge.API.dll
Syntax
public class TriggerContext : FormulaFunctionsWithContext, IFormulaFunctionsWithContext<IBaseEntity>, IFormulaFunctionsWithContext, IFormulaFunctions
Constructors
TriggerContext(IEntityRetriever, IReadOnlyCache, UserInfo, IBaseEntity, IFormulaFunctionsServiceContext)
Creates a new trigger context holding the information for the items that triggered a IActionTriggerGate
Declaration
public TriggerContext(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user, IBaseEntity item, IFormulaFunctionsServiceContext services)
Parameters
Type | Name | Description |
---|---|---|
IEntityRetriever | retriever | A context for querying all the data in the syste, |
IReadOnlyCache | cache | A local cache |
UserInfo | user | The current logged in user |
IBaseEntity | item | The item in the system that this trigger is being activated by |
IFormulaFunctionsServiceContext | services | The services demanded from the IServiceProvider for the use in formulas |
Properties
IsActionMatch
Holds the custom action string from the parameters
Declaration
public string IsActionMatch { get; }
Property Value
Type | Description |
---|---|
string |
IsDeleted
Indicates the triggered item was deleted as it has no current item, and only has a previous item
Declaration
public bool IsDeleted { get; }
Property Value
Type | Description |
---|---|
bool |
IsNew
Indicates the triggered item is new, as it has no older version
Declaration
public bool IsNew { get; }
Property Value
Type | Description |
---|---|
bool |
IsUpdated
Indicates the triggered item is not new, as it has an older version
Declaration
public bool IsUpdated { get; }
Property Value
Type | Description |
---|---|
bool |
NotifyItem
The main item (of type EntityTypeID) that notifies the action to be triggered.
Linked to through a relationship of the gate via ActionItemProperty
Declaration
public object NotifyItem { get; }
Property Value
Type | Description |
---|---|
object |
NotifyOldItem
The previous version of the notification item. Will be null if the notification item is new
Declaration
public object NotifyOldItem { get; }
Property Value
Type | Description |
---|---|
object |
OldItem
Declaration
public object OldItem { get; }
Property Value
Type | Description |
---|---|
object |
Trigger
The parent action trigger that would be triggered by this context
Declaration
public IActionTrigger Trigger { get; }
Property Value
Type | Description |
---|---|
IActionTrigger |
Methods
GetNotifyOldValue(string)
Returns the old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public object GetNotifyOldValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
object | The old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new |
GetNotifyOldValue<T>(string)
Returns the old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public T GetNotifyOldValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
GetNotifyValue(string)
Returns the value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public object GetNotifyValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
object | The value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted |
GetNotifyValue<T>(string)
Returns the value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public T GetNotifyValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
GetOldValue(string)
Returns the old value of the specified property of the MyItem. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public object GetOldValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
object | The old value of the specified property of the MyItem. Returns the previous version if it exists, else returns the current value if the item is new |
GetOldValue<T>(string)
Returns the old value of the specified property of the MyItem. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public T GetOldValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The old value of the specified property of the MyItem. Returns the previous version if it exists, else returns the current value if the item is new |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
GetValue(string)
Returns the value of the specified property of the MyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public override object GetValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
object | The value of the specified property of the MyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted |
Overrides
HasNotifyValueChanged(string)
Returns true if the value of the specified property has changed from the previous version to the current version of the NotifyItem and NotifyOldItem
Declaration
public bool HasNotifyValueChanged(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to see if it has changed between versions |
Returns
Type | Description |
---|---|
bool | True if the value of the specified property has changed from the previous version to the current version |
HasValueChanged(string)
Returns true if the value of the specified property has changed from the previous version to the current version of the MyItem and OldItem
Declaration
public bool HasValueChanged(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property value to see if it has changed between versions |
Returns
Type | Description |
---|---|
bool | True if the value of the specified property has changed from the previous version to the current version |
NotifyItemAs<T>()
The item that notifies the action to be triggered (NotifyItem) as the correct type
Declaration
public T NotifyItemAs<T>()
Returns
Type | Description |
---|---|
T | The NotifyItem as the correct type |
Type Parameters
Name | Description |
---|---|
T | The type to cast the notification item as |
NotifyOldItemAs<T>()
The previous version of the item that notifies the action to be triggered (NotifyItem) as the correct type
Declaration
public T NotifyOldItemAs<T>()
Returns
Type | Description |
---|---|
T | The NotifyOldItem as the correct type |
Type Parameters
Name | Description |
---|---|
T | The type to cast the notification item as |
OldItemAs<T>()
Declaration
public T OldItemAs<T>()
Returns
Type | Description |
---|---|
T | The previous version of the item as the correct type |
Type Parameters
Name | Description |
---|---|
T | The type the old version should be cast to |