Logic Context - C Sharp
A logic context object would be passed to LOC logic during execution, which contains the following important data:
- Task and execution metadata
- Trigger payload
Logic Type | Available |
---|---|
Generic logic | ✅ |
Aggregator logic | ✅ |
Import and Usage
The run
and handleError
function in a logic, which will be invoked by LOC runtime during execution, should receive a ctx
argument:
public static class Logic
{
public static async Task Run(Context ctx)
{
// ctx is the data context
}
public static async Task HandleError(Context ctx, Exception error)
{
// ctx is the data context
}
}
For the error
argument, see Logic Error for details.
Class Reference
Type
Context
Method: Load Task
public async Task<LogicTask> GetTask() {}
Return the Task object (lazy loaded).
Refer to: Task
Method: Load Payload
public async Task<Payload> GetPayload() {}
Return the trigger payload (lazy loaded).
Refer to: Payload
Examples
// get task and execution metadata
var task = await ctx.GetTask();
// get payload
var payload = await ctx.GetPayload();