tags:

views:

23

answers:

1

Apparently, this method no longer gets called... In there we have code for configuring AutoMapper, and for setting model binders.

I know there is a "new" way to do model binders, but... shouldn't I still be able to do it "the old way" until I get that implemented?

Specifically, I have two lines left from my old Application_Start() method that I have been unable to get working:

        AutoMapperConfiguration.Configure();

        ModelBinders.Binders[typeof (ModuleEditModel)] = new DerivedModelBinder();

I've tried simply popping those into the constructor, right after the call to: ServiceLocatorManager.SetLocatorProvider(() => new StructureMapServiceLocator());

And that runs, but.. it seems somehow not to take effect. In running the application it is clear that AutoMapper isn't happy, doesn't have the mappings it is supposed to have, etc.

+1  A: 

Hi Travis,

I answered this question out on the Turbine Discussion board on CodePlex. Here's the source for making the changes you ask for:

public class MvcApplication : TurbineApplication {
    static MvcApplication() {
        // Register the IoC that you want Mvc Turbine to use!
        // Everything else is wired automatically

        // For now, let's use the Unity IoC
        ServiceLocatorManager.SetLocatorProvider(() => new UnityServiceLocator());
    }

    public override void Startup(){
         // Gets called when the application starts up
         // and before all the stuff that Turbine wires up
    }

    public override void Shutdown() {
         // Gets called when the application shuts down
         // and before any cleanup is done by Turbine
    }
}

Hope this helps!

Javier Lozano
thanks Javier! You surprised me by answering so quickly :) When I saw only a few posts there I figured it wasn't the right place to post. Thanks again!
Travis Laborde