Skip to content

Create custom bootstrapper task

hazzik edited this page Apr 14, 2012 · 2 revisions

By design all bootstrapper code in MvcExtensions should be placed into BootstrapperTasks. Here a small example of how to write your own task.

Your bootstrapper task should inherit BootstrapperTask base class. It has only one method to override Execute which returns TaskContinuation enumeration.

public class MyCustomTask: BootstrapperTask
{
    public override TaskContinuation Execute()
    {
        //your code goes here.
        return TaskContinuation.Continue;
    }
}

When the bootstrapper task written you should include it into task execution sequence:

//Global.asax.cs
public class MvcApplication : WindsorMvcApplication
{
    public MvcApplication()
    {
        Bootstrapper.BootstrapperTasks
            .Include<RegisterControllers>()
            // other tasks
            .Include<MyCustomTask>();
    }
}
Clone this wiki locally