Tuesday, May 27, 2008

Preview 3

Woo hoo!

http://weblogs.asp.net/scottgu/archive/2008/05/27/asp-net-mvc-preview-3-release.aspx

I just updated the test site to use it. Other than 1 case of me not following instructions, it went smooth.

The HTML helpers have been changed. I was using an Html.Textbox signature that's no longer valid. Apparently, they'd rather you build the htmlAttributes collection and pass that in. For now, I merely simplified the call losing the SIZE and MAXLENGTH properties.

There's a major change to the ACTIONS, which I like a lot. Previously, the methods were of type VOID, and you'd do things like:

RenderView("Index")
or
RedirectToAction("Logout")

Now, you change the VOID to ActionResult, and change the actions to:

return View("Index")
or
return RedirectToAction("Logout")

Now, rather than instructing it to do something, you're returning an object that tells it what to do. So, now its more testable. You can write a test for the action and make sure that it returns the ActionResult that it should. Sweet.

Also, the ViewData object has changed. It used to be ViewData<T> where T is the type of the object passed to the view. That has changed to ViewData.Model<T>. This allows ViewData to provide other types of things such as...ummmm... Hang on a sec. I was really excited about that until just now. I pulled up the intellisense and didn't get what I expected. I'll have to look into that more, though I like the approach in intent. It is a place where a lot more things can be exposed other than just your view data object. As the framework grows, they can keep adding new things to ViewData.

Back to the grind.

No comments: