MVCTurbine and MVC3

Oct 10, 2010 at 2:29 PM


I've seen talk about moving towards v3 that would be aimed at MVC3. Can you give any time estimates for that? And is there anything in the meanwhile that I can do to make it compatible with MVC3 Beta, because there is no MvcServiceLocator anymore.


Oct 11, 2010 at 3:03 AM


Javier's the guy to talk to when it comes to any time estimates or plans.  However, since the codebase is on Github, I took it upon myself to see what it would take to make MVC Turbine compatible with the newly released MVC3, and I think I've reached it.  My changes may or may not be what make the final cut, but it can at least be an early spike to see what it will take to update Turbine for MVC3.

My MVC3 branch can be found on Github at the address below.  By the time I was done I was able to successfully plug MVC Turbine into the default MVC3 site.  I didn't put the test site through its paces, though.  It's only a start.

Here are my initial thoughts after having gone through this:

1.)  As can be expected, MVC3 is going to let a lot of custom resolution code to be removed from Turbine.  Since the MVC3 framework can now handle the resolution of the base MVC types through an IoC container, there's no need for Turbine to do the same thing.  

2.)  I created a TurbineDependencyResolver class that implements MVC3's new IDependencyResolver interface.  The TurbineDependencyResolver is just a wrapper around the IServiceLocator, with one exception:  If the requested type cannot be resolved, it has to return null.  This isn't my idea, it's a requirement for the framework (

3.)  I create a core Turbine blade that registers the TurbineDependencyResolver with the MVC3 framework.  This means that the resolution of many, if not all, of the core MVC bits will be resolved out of the IServiceLocator.  See (1) above.  

4.)  I added a ResolveServices(Type type) method to IServiceLocator to make it compatible with the "IEnumerable<object> GetServices(Type type)" method on IDependencyResolver.  I implemented the new method through all of the IoC containers except Autofac, which didn't have the method for me to do it already.

5.)  I had to upgrade all of the assemblies to .Net 4.

6.)  I noticed that if an implementation of IControllerFactory is registered in the IoC container *AND* one is set through the static ControllerBuilder class, MVC3 will throw an exception telling you to pick one or the other.  


That's all I have right now.  Hope it helps!



Oct 12, 2010 at 5:17 AM

Hi Darren

You seem to have done quite a bit of work.

I downloaded you version of MvcTurbine (MT), built it, hooked it up to a test app and managed to do a simple DI and it worked :)


But I seem to be a bit too green at MT and DI to actually grasp everything you explained in your post (I re-read it about 5 times).

It would be nice to see some more in depth MT tutorials as I suspect that there is a lot more to it then I see right now.


But really thanks Darren for this, I can now actually use MT in my project and start learning it :)



Oct 12, 2010 at 12:14 PM


Please feel free to ask any questions about how MVC Turbine works here, or at the Google group at the link below.

Also, I'm posting a link to some videos MVC Turbine videos that I posted on Youtube recently.  I haven't recorded one specifically on dependency injection in Turbine, but they might give you another view on the things Turbine can do for you.

And we have been working on documentation, seriously.  We have multiple documents written, just not "finished" and added to the wiki.  We have to get on that. :)




Oct 12, 2010 at 2:21 PM

Hi Goran,

Sorry for being MIA on this thread - it's been a long weekend and busy Monday.  :)

Darren has done a great job on getting the bits ready for the MVC3 port, we will continue to work with his bits to get the pieces completed and 'production' ready for people to try. For now, I'm finishing up the v2.2 bits which encompass some bug fixes to the runtime so that will be out soon. I opted to remove some of the fluent registration features from this release in order to get it out the door :) But at the same time, the new "provider" pieces of MVC3 will make it easier for us to integrate into the filter, model binder, etc. pieces so we can provide IoC support to them.

Like Darren mentioned, checkout the Google Group for "in-depth" development details and feel free to join the discussion!

Mar 13, 2011 at 2:13 PM

Just looking to get an update re: the process of updating to MVC3. Thankx

Mar 14, 2011 at 1:27 PM

Javier has a branch on the Github account with a version of Turbine that works for MVC3.  It's in "internal testing," so to speak, but so far everything looks fine.  

Should be releasing an official build soon.