Interface ITask
Interface representing a task with properties and methods for execution and error handling.
Namespace: Serenity.Tasking.Application.Interfaces
Assembly: Serenity.Global.Application.dll
Syntax
public interface ITask
Properties
Criticality
Criticality level of the task.
Declaration
TaskCriticality Criticality { get; }
Property Value
| Type | Description |
|---|---|
| TaskCriticality | The criticality level. |
Id
Unique identifier for the task.
Declaration
string Id { get; }
Property Value
| Type | Description |
|---|---|
| string | The unique identifier as a string. |
LastError
Gets the last error that occurred during task execution, if any.
Declaration
Exception LastError { get; }
Property Value
| Type | Description |
|---|---|
| Exception | The last exception encountered, or null if none. |
Weight
Weight of the task, influencing its scheduling and resource allocation.
Declaration
float Weight { get; }
Property Value
| Type | Description |
|---|---|
| float | The weight of the task. |
Methods
RunAsync(CancellationToken)
Runs the task asynchronously.
Declaration
Task RunAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |