Search Results for

    Show / Hide Table of Contents

    Class BaseTriggerTask

    The base task for implementing any type of custom action that runs as a task against a IActionTrigger task

    Inheritance
    System.Object
    BaseTriggerTask
    Implements
    ITaskProcessor
    IProcessor
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.API.Tasks.Process.Triggers
    Assembly: API.dll
    Syntax
    public abstract class BaseTriggerTask : ITaskProcessor, IProcessor, IDisposable

    Properties

    Action

    A custom action string for matching against a TriggeredActionParameter

    Declaration
    protected abstract string Action { get; }
    Property Value
    Type Description
    System.String

    Cache

    A local cache for performance

    Declaration
    public IReadOnlyCache Cache { get; }
    Property Value
    Type Description
    IReadOnlyCache

    ForID

    The list of entitiy ids this action is triggered against

    Declaration
    protected abstract Guid? ForID { get; }
    Property Value
    Type Description
    System.Nullable<System.Guid>

    ForTypes

    The types of entities this action is triggered against

    Declaration
    protected abstract Guid[] ForTypes { get; }
    Property Value
    Type Description
    System.Guid[]

    Param

    The trigger action parameters inheriting from BaseTriggerParameter

    Declaration
    protected ServerTaskParameter Param { get; }
    Property Value
    Type Description
    ServerTaskParameter

    Reporter

    A reporter to provide feedback to a log, or client depending on the context the process is running under

    Declaration
    public BusyProgressReporter Reporter { get; set; }
    Property Value
    Type Description
    BusyProgressReporter

    Runner

    The host that is running this action trigger task

    Declaration
    public ITaskRunner Runner { get; }
    Property Value
    Type Description
    ITaskRunner

    TimeStamp

    The timestamp of the changes that occured that triggered this action

    Declaration
    protected abstract DateTimeOffset? TimeStamp { get; }
    Property Value
    Type Description
    System.Nullable<System.DateTimeOffset>

    TriggeredContexts

    A list of the contexts that triggered this action

    Declaration
    protected abstract IDictionary<IActionTrigger, List<TriggerContext>> TriggeredContexts { get; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<IActionTrigger, System.Collections.Generic.List<TriggerContext>>

    TriggerID

    The IActionTrigger that triggered this action

    Declaration
    protected abstract Guid? TriggerID { get; }
    Property Value
    Type Description
    System.Nullable<System.Guid>

    Updater

    A context to ensure the process can query, load and modify all LemonEdge data

    Declaration
    public IEntityUpdater Updater { get; }
    Property Value
    Type Description
    IEntityUpdater

    User

    The current logged in user the process is running under

    Declaration
    public UserInfo User { get; }
    Property Value
    Type Description
    UserInfo

    Methods

    Dispose()

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Init(ITaskRunner, ServerTaskParameter)

    Initializes the task processor with the trigger action parameters for processing the task

    Declaration
    public Task Init(ITaskRunner runner, ServerTaskParameter ProcessTaskParameter)
    Parameters
    Type Name Description
    ITaskRunner runner

    The context within which the task is being processed

    ServerTaskParameter ProcessTaskParameter

    The trigger action parameters inheriting from BaseTriggerParameter

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    ProcessTask(CancellationToken)

    If TriggeredContexts is null then this is the IActionTrigger task that determines which, if any, actions should be triggered.

    It then populates TriggeredContexts for every matching action, and creates the appropriate triggered action task to process the action. These tasks inherit from BaseTriggerTask too, and are marked with LemonEdge.API.Tasks.Process.Triggers.TriggerTask

    Each triggered action task has its TriggeredContexts set to the contexts that created the action, passes the parameters from TriggeredActionParameter and executes the action.

    Both then call ProcessTriggers(IDictionary<IActionTrigger, List<TriggerContext>>, CancellationToken) with the TriggeredContexts values (either calculated or passed)

    All implementations simply have to implement ProcessTriggers to perform the custom action required now IActionTrigger has triggered them
    Declaration
    public Task<object> ProcessTask(CancellationToken cancel)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancel
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Object>

    ProcessTriggers(IDictionary<IActionTrigger, List<TriggerContext>>, CancellationToken)

    Processes the items that have been triggered by the IActionTrigger

    Declaration
    protected abstract Task ProcessTriggers(IDictionary<IActionTrigger, List<TriggerContext>> triggeredItem, CancellationToken cancel)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<IActionTrigger, System.Collections.Generic.List<TriggerContext>> triggeredItem

    A dictionary of each triggered item and the contexts that triggered it

    System.Threading.CancellationToken cancel

    A cancellation token for cancelling the task process

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    Implements

    ITaskProcessor
    IProcessor
    System.IDisposable

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)
    In This Article
    Back to top © LemonEdge Technology. All rights reserved.