What is MVC Turbine?

Like the tag name says it, MVC Turbine converts flow into useful work by providing a pipeline that's built on top of an ASP.NET MVC application. Typically, when you create an MVC application within Visual Studio, you get:

public class MvcApplication : System.Web.HttpApplication
    public static void RegisterRoutes(RouteCollection routes)

            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults

    protected void Application_Start()

Although the code is functional, it's pretty bare bones. If your application wants to use an Inversion of Control (IoC), you will need to manually wire it. With MVC Turbine, the support for a IoC, through a Service Locator, comes out of the box. That means that all Controllers within your application are auto-registered with the Service Locator which in turn registers it to the underlying IoC container.

Your MVC application code then reduces to this:

using MvcTurbine;
using MvcTurbine.ComponentModel;
using MvcTurbine.Windsor;

public class DefaultMvcApplication : TurbineApplication
    //NOTE: You want to hit this piece of code only once.
    static DefaultMvcApplication()
        //TODO: Specify your own service locator here if you don't want to use Windsor.
        ServiceLocatorManager.SetLocatorProvider(() => new WindsorServiceLocator());

Pretty simple, huh? However, there's much more that MVC Turbine offers, specially when it comes to automatic or manual service registration.

Last edited Jun 23, 2010 at 5:39 PM by jglozano, version 5


No comments yet.