jQuery for ASP.NET MVC preview 2

I updated the jQueryMvc project so that it works with ASP.NET MVC preview 2. I also switched the IoC container from Objectbuilder to Unity. I submitted the Unity container to the MvcContrib project but it has not yet been accepted in their repository, so you’ll have to do with the unofficial version I include in the download. Unity is, to put it very baldly, Objectbuilder version 2. So it seemed logical to make the switch.

I also made up a nice(r) way to inject the ViewEngine into the BaseController. It’s now injected through a public method using a MethodInjection attribute:


Thanks to this method, we no longer have pre-register all the Controllers with our container (in the previous version of jQueryMvc I scanned all dll’s on ApplicationStart to register the Controller and assign the ServiceViewFactory as the default ViewFactory)

Furthermore, since the ASP.NET MVC team decided to change the way the Views are rendered (now through a ViewEngine, which is nice I think), it was no longer needed to use the code from Aaron Lerch. Though still inspired by his code ofcourse, I removed almost all of his code now. We now have a single ‘ServiceViewEngine‘ inheriting from the ASP.NET MVC’s default WebFormViewEngine. All code deciding what view to render, is now located in this class.

What I did not like about preview 2, is that the name of the master-template cannot be set from within the ViewEngine. It’s now stored into the ViewContext, and the setter is private :(. So now the mastertemplate is set in the BaseController, causing the BaseController to have to know what type of request the current one is (which is bad):


As usual, you can download the hottest source from the Subversion repository at http://code.google.com/p/jquerymvc/source/checkout or you can download a zipped package of the source code.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.