Links controller to its context ITask object. The
framework takes care of setting this property, so that every controller
can access its task (see the example at the bottom).
Namespace:
MVCSharp.CoreAssembly: MVCSharp (in MVCSharp.dll)
Version: 0.8.5217.34148
Syntax
Remarks
The setter method of the Task property is often used
to do the necessary controller initialization:
CopyC#
class MyController : ControllerBase { public override ITask Task { get { return base.Task; } set { base.Task = value; // Do controller initialization } } }
Examples
Here we access the task state from the controller:
CopyC#
class MyController : ControllerBase { public void DoSomething() { if ((Task as MyTask).Counter >= 5) MessageBox.Show("You cannot do something more than five times."); else (Task as MyTask).Counter++; } }