Notes on ASP.NET MVC CodePlex Preview 4

aspnetmvc 0 comments suggest edit

(If you want to skip all the blah blah blah, go straight to the release)

What I love about working with The Gu (aka ScottGu, the man with many aliases) is that he makes my life easier with his gargantuan and detailed blog posts covering the features of each release. This allows me to follow up and fill in some details with a much shorter post, as by the time we get a release out the door, I’m usually too exhausted to write such a detailed post as he does. Yeah, excuses excuses.

In his latest post, Scott covers the ASP.NET MVC CodePlex Preview 4 release in two parts. This is the next in a continuing series of preview releases that alternate between full CTP level releases on ASP.NET and interim releases on CodePlex. Unlike previous CodePlex releases, this one contains an MSI installer for convenience. There are still some rough spots with some of the new features as we tried to get a lot into this release to elicit feedback. In fact, I’ve been doing some app building today and have already run into some areas for improvements with the Ajax helpers. I look forward to hearing your feedback as well.

MVC Futures

One thing you’ll notice in the project template that Scott didn’t cover in much detail is that we include a new assembly, Microsoft.Web.Mvc.dll. The release notes explain what this is.

The ASP.NET MVC team builds prototypes for a lot of features during the course of normal development. Some of these features will not be included in the RTM release, but are very likely to be included in a future full release. We’ve moved many of these features into a separate assembly, Microsoft.Web.Mvc.dll.

This follows what the ASP.NET’s team intends the term Futures to mean when it comes to products. Futures should contain features that we think has a decent chance of making it into the framework. If we implement something we are pretty sure we have no intention of including in the framework, we’ll typically post it as a blog sample or something to that effect.

Component Controller

For those that have used this, you’ll notice that we removed the ComponentController class. Instead, we renamed RenderComponent to be RenderAction and re-implemented it so that it works against a normal controller. This code is was moved to the MVC Futures assembly since we’re not planning to include it in the RTM.

My personal opinion is that this violates the separation of concerns so important to the MVC pattern. Having a method within your view calling back into a controller in order to render out a bit more view makes me feel a wee bit dirty ;). We’re developing prototypes for an alternative approach. In the meanwhile, I recognize that for a small sacrifice of pattern purity, this method is very useful, hence its inclusion in the MVC Futures assembly, but do understand that you use it at your own risk.

What’s Next?

The roadmap for ASP.NET MVC has been up on the CodePlex site for a while. We still have more cleanup and implementation work to do on the Ajax features, as well as existing and new helper methods. Likewise, we are tackling the problem of how should you report validation errors to the user via a common error reporting mechanism. This might not handle validation itself, but gives everyone a common place to put validation messages and allows for some of HTML helpers to be aware of these messages and render themselves accordingly.

And before I forget, you can download ASP.NET MVC CodePlex Preview 4 from the release page.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.



34 responses

  1. Avatar for Shane Milton
    Shane Milton July 16th, 2008

    I know what one of my weekend projects are going to be now! :)

  2. Avatar for Simone Chiaretta
    Simone Chiaretta July 16th, 2008

    That's the first time I get the announcement and I'm not on holiday... I missed 4 announcement before :)

  3. Avatar for Lamin Barrow
    Lamin Barrow July 16th, 2008

    Yeppeeee preview 4 is out finally. I can't wait to checkout all the new stuff. Thanks for all your effort Phil.

  4. Avatar for Shiju Varghese
    Shiju Varghese July 16th, 2008

    Great work. Congrats to the MVC team.

  5. Avatar for Adam Webber
    Adam Webber July 16th, 2008

    I'm looking forward to learning about your alternative approaches to the 'dirty' RenderComponent technique. There is certainly a need to incorporate a mechanism to separate out chunks of V-C so that composable pages do not end up with a mega controller.
    Note also that moving this to Futures contradicts your earlier statement that 'If we implement something we are pretty sure we have no intention of including in the framework, we’ll typically post it as a blog sample or something to that effect.' (as opposed to putting it in Futures)
    Best wishes,

  6. Avatar for Fredrik
    Fredrik July 16th, 2008

    I am dying to work with Asp.Net MVC and IronRuby.
    I don't know when that day will come. I dont hear any news about it. My last hope was preview 4, but too failed.
    How long should i continue working with Rails only.
    Hello Phil...Please hack some news from team/DLR team and share it here.

  7. Avatar for Jay Patel
    Jay Patel July 16th, 2008

    Its superb man . . . We were expecting it soon . . .

  8. Avatar for Torkel
    Torkel July 16th, 2008

    Just a question regarding the Ajax helpers, how tied are these to a specific javascript library? If it is possible, without restricting featuers to the lowest common denominator to much, it would be great if the ajax library was pluggable, so you could for example use JQuery or Prototype with the MVC Ajax helpers.

  9. Avatar for thr
    thr July 16th, 2008

    Has anybody tried to use RouteDebuger with preview4?

  10. Avatar for Steve
    Steve July 16th, 2008

    Could more details be given on exactly what is in 'Futures' ?

  11. Avatar for Steve
    Steve July 16th, 2008

    I'm missing html helpers now?
    ie. submitbutton, image, etc...
    Were these removed?

  12. Avatar for Steve
    Steve July 16th, 2008

    ok, they are now in Futures?
    Seems odd to move core items like SubmitButton and Image to Futures
    It was there in Preview 3, works fine - I don't get the change? Please explain this???

  13. Avatar for Steve
    Steve July 16th, 2008

    Sorry, seems that after I rebuilt again, closed the page, and reopened those are now there.
    I did add a reference in my web.config to the futures - then saw the extensions - would this be correct?
    I would think some of those items would no longer be futures.

  14. Avatar for Steve
    Steve July 16th, 2008

    Another question:
    Now I'm getting this error:
    "The provider requires SessionState to be enabled"
    Is there something new here ???

  15. Avatar for Jamie
    Jamie July 16th, 2008

    Is there any chance you guys will ramp up efforts on sub-controllers and try to get them into the official release? All of this AJAX stuff is nice, but kind of unnecessary. Most of the AJAX libraries out there do just great on their own and it would be easy as pie to write our own helpers.
    Sub-controller support on the other hand is something that seems sorely lacking in the current MVC framework and have the most chance of causing a lot of pain to rework things when it is finally released. If we start using RenderComponent now, then something totally different is released later, that's much more of a change than just reworking a few helpers for AJAX. I know that AJAX is one of the silver hammers everyone's all hyped about right now, but why is it superceding good componet support?
    At the very least, maybe we could get more visibility into what you're doing with sub-controllers so if we roll our own in the meantime we won't have as much to change later?

  16. Avatar for varun
    varun July 16th, 2008

    [yeahh!!!] finally !!!!
    Now after a long wait I can use some normal Loging in and login out stuff without jumpin into any mess!!! [u]and the Ajax support is deeply appreciated[u] thanx

  17. Avatar for Gavin
    Gavin July 16th, 2008

    If anyone else has issues with that "sessionstate required" problem, see the post on the mvc forums at:

  18. Avatar for Emad Ibrahim
    Emad Ibrahim July 17th, 2008

    Very cool. I can't wait to upgrade
    I love the new tempdata implementation which should make testing a lot easier.
    I am a little nervous of the integration with microsoft ajax because I use jquery... hopefully things will work out.
    I love MVC and don't want to do web forms ever again :)
    Keep up the great work

  19. Avatar for Rob G
    Rob G July 17th, 2008

    Hey Phil, great stuff! Any views (no pun intended) on the best way to go from P3 to P4? Doesn't look like the MSI likes the fact that we've got P3 installed - any easy way to move all the test sites I've created with P3 to P4?
    If not - oh well, time to roll up those sleeves!
    Rob G

  20. Avatar for haacked
    haacked July 17th, 2008

    @Ryan we're definitely looking into it, and have been working on such features in parallel to all the work we released in Preview 4. Do you have certain specific scenarios that are blocked or made difficult you'd like to supported?

  21. Avatar for haacked
    haacked July 17th, 2008

    @Rob you have to uninstall P3 first. However, updating an existing site should be pretty easy. Check out the readme notes.

  22. Avatar for Mike
    Mike July 17th, 2008

    "For those that have used this, you’ll notice that we removed the ComponentController class. Instead, we renamed RenderComponent to be RenderAction and re-implemented it so that it works against a normal controller. This code is was moved to the MVC Futures assembly since we’re not planning to include it in the RTM."
    Can you explain this further and also explain the alternative, because I thought this was exactly what was needed and don't understand why it's bad.

  23. Avatar for Mike
    Mike July 17th, 2008

    Could you guys release a zip with just the dll's, I don't really like 'installers'

  24. Avatar for david alpert
    david alpert July 17th, 2008

    How does Html.RenderUserControl(...) fit into the refactoring of RenderComponent into RenderAction?
    I wasn't using RenderComponent, i was using RenderUserControl, but that was looking for a Component Controller in the /Components/ folder....
    Now my "ComponentController" inherits from "Controller" in the absence of ComponentController, so i moved it into my /Controllers/ folder, but now RenderUserControl(...) can't find it!
    All this to enable paging as a user control!

  25. Avatar for david alpert
    david alpert July 17th, 2008

    oops. measure twice, cut once, or something like that.
    I was looking at the wrong place in my code; RenderUserControl still works like a dream.

  26. Avatar for tgmdbm
    tgmdbm July 17th, 2008

    Hey Phil, I thought that the RenderAction method was the best way to encapsulate some reusable logic... that is until it came time to test it. You really see how badly it breaks the MVC model.
    ComponentController was fine but you lost your IoC goodness.
    Looking forward to how this looks in the next preview.

  27. Avatar for Meisinger
    Meisinger July 17th, 2008

    Could you image what WebForms would be like if a similar approach was taken like this one for MVC?
    I love getting the bits and getting to play around with them early. I also appreciate the fact that your team is so open to suggestions and feedback. It has really been great to see some of our feedback getting put in and considered.
    I think that we all realize some hard decisions are going to have to be made for RTM (what's in, what's out, what goes to Futures, etc...) but I think that we have a real good opportunity with leveraging the MvcContrib project. With the bits made available to us there is nothing stopping us from writing our own jQuery "providers" etc...
    In short... keep up the great work

  28. Avatar for David O'Hara
    David O'Hara July 17th, 2008

    Phil, I was curious about the decision to add the Eval method to the Controller and pull it's use in the indexer. Could you speak to that decision or point me to someone who could?? Thanks!!

  29. Avatar for Joel Duvall
    Joel Duvall July 17th, 2008

    Phil, I love the new MVC framework.
    For Validation it would be nice if you could keep existing the existing technique used in Dynamic Data by having a metadata class or being able to use the metadata class if available. I think I saw or heard you guys were already thinking this way. I would love to see what this might look like as soon as possible.

  30. Avatar for Andrew
    Andrew July 18th, 2008

    I can not comprehend the decision regarding Component Controller, the team took something that was working reasonably well and completely bodged it up so much so its now considered bad usage (and awkward to use) and wont be in RTM.
    I have been using them successfully and am now stuck at needing output caching and having to re-engineer these components to use this broken method.

  31. Avatar for Corey Gaudin
    Corey Gaudin July 18th, 2008

    Comment to tgmdbm.
    I here what you said about RenderAction, however, keep in mind that it does not really break down in testability wise, because you should be testing all of your controller and actions. So if a particular view calls a RenderAction<someothercontroller>(c => c.ControlPiece(someKey)), then you should be writing a test for the original action and the ControlPiece action.
    So while I agree the controller doesnt flow up the model data for all of the view, the controller is still the keeper for getting the model data. Its no different then using Javascript to use AJAX to partially pull html or a json object (and build html) once a view is loaded. The only difference is it is done before the page is fully rendered to the client.
    Baring this, I see no reason why it violates a MVC pattern. The controller is still keeping the model data logic behind it, its just that you might have a call to an action more than once per view. Again, no different that a AJAX heavy view which handles parital rendering.

  32. Avatar for Serge Van Meerbeeck
    Serge Van Meerbeeck July 18th, 2008

    I really like the momentum of ASP.NET MVC.
    However, I was wondering: I just migrated to Preview 4, and I seem to miss a couple of extension methods on the HtmlHelper for Button, more specifically the ones that take an Expression<action<t>> as an argument. No harm done, it takes 2 minutes to add them myself, but nevertheless ...
    Any reason why they were removed while moving the extensions to the Futures dll?

  33. Avatar for Ahtesham
    Ahtesham July 18th, 2008

    haacked , what about helper of views in this preview , also what about subcontrollers , also one more thing why not any one who understand MVC well has put a extensive example on the net , so ppl like me who are not that advanced can learn how they can do stuff in MVC, why mostly exmple on net is one or 2 views.hope You Gods of MVC will answer that
    But Great learning Curve for New ppl like me ,Thanks

  34. Avatar for Mehrdad
    Mehrdad August 6th, 2008

    I think an important part in MVC pattern implementation is the routing part. This is usually best to be done declaratively. Some MVC focused frameworks such as Cocoa has done this well (while I don't like Apple's interface builder system, I think the routing part is done pretty well). I think MVC needs some XML based declartive syntax to declare connections (probably using a special build provider or something you know better ;) )