Base generic implementation of the IController<(Of <(TTask, TView>)>) interface. Has strongly typed associations to the linked task and view (of generic parameter types TTask and TView respectively) therefore eliminates the need of typecasting when accessing the task and the view.

Members are marked as virtual so it is possible to override them in subclasses.

Namespace:  MVCSharp.Core
Assembly:  MVCSharp (in MVCSharp.dll)
Version: 0.8.5217.34148

Syntax

C#
public class ControllerBase<TTask, TView> : IController<TTask, TView>, 
	IController where TTask : class, ITask where TView : class
Visual Basic (Declaration)
Public Class ControllerBase(Of TTask As {Class, ITask}, TView As Class) _
	Implements IController(Of TTask, TView), IController
Visual C++
generic<typename TTask, typename TView>
where TTask : ref class, ITask
where TView : ref class
public ref class ControllerBase : IController<TTask, TView>, 
	IController

Type Parameters

TTask
Specifies the expected type of the associated task. Must be a subtype of ITask.
TView
Specifies the expected type of the associated view.

Examples

ControllerBase class frees users from implementing IController<(Of <(TTask, TView>)>) manually, yet allowing to override IController<TTask, TView> members:
CopyC#
class MyController : ControllerBase<MyTask, IMyView>
{
    public void MyOperation()
    {
        View.MyViewOperation(); // Typecasting NOT required
    }

    public override MyTask Task
    {
        get { return base.Task; }
        set
        {
            base.Task = value;
            // Do controller initialization here
        }
    }
}

Inheritance Hierarchy

System..::.Object
  MVCSharp.Core..::.ControllerBase<(Of <(TTask, TView>)>)

See Also