ASP.NET MVC Preview 3 Release

This morning we released the Preview 3 build of the ASP.NET MVC framework.  I blogged details last month about an interim source release we did that included many of the changes with this Preview 3 release.  Today’s build includes some additional features not in last month’s drop, some nice enhancements/refinements, as well as Visual Studio tool integration and documentation.

You can download an integrated ASP.NET MVC Preview 3 setup package here.  You can also optionally download the ASP.NET MVC Preview 3 framework source code and framework unit tests here.

Controller Action Method Changes

ASP.NET MVC Preview 3 includes the MVC Controller changes we first discussed and previewed with the April MVC source release, along with some additional tweaks and adjustments. 

You can continue to write controller action methods that return void and encapsulate de cialis all of their logic within the action method.  For example:

Evgeniya rodina

which would render the below HTML when run:

Preview 3 also now supports using an approach where you return an “ActionResult” object that indicates the result of the action method, and enables deferred execution of it.  This allows much easier unit testing of actions (without requiring the need to mock anything).  It also enables much cleaner composition and overall execution control flow.

For example, we could use LINQ to SQL within our Browse action method to retrieve a sequence of Product objects from our database and indicate that we want to render a View of them.  The code below will cause three pieces of “ViewData” to be passed to the view - “Title” and “CategoryName” string values, and a strongly typed sequence of products (passed as the ViewData.Model object):


One advantage of using the above ActionResult approach is that it makes unit testing Controller actions really easy (no mocking required).  Below is a unit test that verifies the behavior of our Browse action method above:

 

We can then author a “Browse” ViewPage within the \Views\Products sub-directory to render a response using the ViewData populated by our Browse action:

When we hit the /Products/Browse/Beverages URL we’ll then get an HTML response like below (with the three usages of ViewData circled in red):

Note that in addition to support a “ViewResult” response (for indicating that a View should be rendered), ASP.NET MVC Preview 3 also adds support for returning “JsonResult” (for AJAX JSON serialization scenarios), “ContentResult” (for streaming content without a View), as well as HttpRedirect and RedirectToAction/Route results.  

The overall ActionResult approach is extensible (allowing you to create your own result types), and overtime you’ll see us add several more built-in result types.

Improved HTML Helper Methods

The HTML helper methods have been updated with ASP.NET MVC Preview 3.  In addition to a bunch of bug fixes, they also include a number of nice usability improvements.

Automatic Value Lookup

With previous preview releases you needed to always explicitly pass in the value to render when calling the Html helpers.  For example: to include a value within a <input type=”text” value=”some value”/> element you would write:

The Internet Dictionary Project: Download the Dictionary Files

Dictionary / free download
Dictionary v2.6(Vikrant P. Chavan) FULL VERSION. FREE! English to English Mobile Dictionary. Easy to use. Compatible with all J2ME devices. Size: 1 MB.

WordWeb: Free English thesaurus dictionary download
Download free English thesaurus and dictionary software for Windows.

Download the Dictionary Files. The files which are produced by the IDP and the many volunteers who have visited these pages are available here for anyone to

The above code continues to work - although now you can also just write:

The HTML helpers will now by default check both the ViewData dictionary and any Model object passed to the view for a ProductName key or property value to use.

SelectList and MultiSelectList ViewModels

New SelectList and MultiSelectList View-Model classes are now included that provide a cleaner way to populate HTML dropdowns and multi-select listboxes (and manage things like current selection, etc).  One approach that can …


Related posts: Zack addy, Carter hotel, Ted butler, Hillary clinton kennedy assassination, Camp century



Recently:


You must be logged in to post a comment.

Name (required)

Email (required)

Website

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Share your wisdom

  • Calendar

    May 2008
    M T W T F S S
    « Apr   Jun »
     1234
    567891011
    12131415161718
    19202122232425
    262728293031  
  • Asides

      Place for sideblog or ads

      Nullam sit amet nisl ac erat luctus tincidunt. Etiam dui lectus, vulputate eget, dignissim ut, bibendum eget, odio. Donec dignissim sapien. Duis est. Aenean sit amet orci eget risus gravida tempor.

  • FlickR

      Solitude
      Solitude
      Solitude
  • My del.icio.us