Defining controllers
In Taskurai, commands can be defined in either plain classes or can be derived from WorkerController.
Choose the approach that suits your needs best, the WorkerController provides easy shortcuts for common tasks like logging and task completion (otherwise the TaskuraiTaskContext can be used directly).
Prerequisites
- You have completed:
Using a WorkerController
- C#
Controllers/TestController.cs
using System.Net;
using Taskurai.Models;
using Taskurai.Worker;
public class TestController: WorkerController
{
private readonly IConfiguration _configuration;
public TestController(IConfiguration configuration)
{
_configuration = configuration;
}
}
Using a plain class
When using a plain class as a controller, the class should be marked with the [WorkerController] attribute.
- C#
Controllers/TestController.cs
using System.Net;
using Taskurai.Models;
using Taskurai.Worker;
[WorkerController]
public class TestController
{
private readonly IConfiguration _configuration;
public TestController(IConfiguration configuration)
{
_configuration = configuration;
}
}