Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Casey Charlton - Insane World

Hang the code, and hang the rules. They're more like guidelines anyway


Problems Upgrading ASP.NET MVC to Preview 5

Expecting it to be painless to move from Preview 4 to Preview 5 was probably hoping a little too much ... but it certainly wasn't the worst thing in the world.

A couple of things did catch me that I didn't find in the notes for upgrade, so I thought I best post them in case someone else gets the same problems:

BindingHelperExtensions.UpdateFrom has gone

Yep, gone ... which was a bit of a pain. I understand many people are using other methods, and probably we should be too, but this was the simplest option and is now being used commonly here.  In it's place it turns out that you can use:

UpdateModel.From(model, Request.Form.AllKeys)

this.ReadFromRequest has gone

Another removal, the replacement is:

Request["key"]

LinkBuilder and BuildUrlFromExpression gone

Actually they haven't, but they have been moved to Microsoft.Web.Mvc ... so you probably need to change your references to the new assembly.

Multiple Entries for System.Web.Routing in web.config

I did a manual edit to change the assembly version from 0.0.0.0 to 3.5.0.0 and I missed a few - it seems there are 4 entries for this assembly in my web.config - so check you updated all of them ...

Update: Html.CheckBox("rememberMe", "Remember me?", "rememberMe", true) has changed!

Missed this one till one of the developers here tried to get the login page to work ... it looks like they changed the signature of this, and a few other Html.xxxx extensions ... a bit of a pain, we only have around 50 views at the moment, and unfortunately it isn't a simple find/replace ... oh well ...

Further Update: Html.ActionLink is just plain broken

Grrrr ... This is annoying ...  They went and changed the signatures on Html.ActionLink

This wouldn't be so bad, except that our previous line of:

Html.ActionLink("edit", "Edit", ViewData.Model.ControllerName, new { item.Id })

Doesn't work, and results in a link with ?Length=8 on the end of it. This appears to be because it is matching the wrong signature on the ActionLink overloads, and now matches "string controllerName" as object instead.

Fixing it is rather "yuk" ... force it to use the right overload with:

Html.ActionLink("edit", "Edit", ViewData.Model.ControllerName, new { item.Id }, null)

 

 



Comments

Corey said:

Scott Guthrie's mentions the changes in his latest blog post. Might make the migration a bit less painful.

# September 2, 2008 10:47 AM

Reflective Perspective - Chris Alcock » The Morning Brew #171 said:

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #171

# September 3, 2008 3:05 AM

Colin Jack said:

"Yep, gone ... which was a bit of a pain. I understand many people are using other methods, and probably we should be too, but this was the simplest option and is now being used commonly here.  In it's place it turns out that you can use:

UpdateModel.From(model, Request.Form.AllKeys)"

Except when it then tries to bind the submit button, very annoying change.

# September 3, 2008 6:14 AM

ASP.NET MVC Archived Blog Posts, Page 1 said:

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

# September 3, 2008 10:05 AM

Tim Barcz said:

Yeah this is old hat, I know.  The Preview 5 release was news about three weeks ago.  There

# September 22, 2008 10:55 PM

Community Blogs said:

Yeah this is old hat, I know.  The Preview 5 release was news about three weeks ago.  There

# September 22, 2008 11:33 PM

sergiopereira said:

"Further Update: Html.ActionLink is just plain broken"

Yep, this was a nasty change (or accident)... The worst part is that it will probably be repaired before release, causing "the other half" of the cases (the ones using the sorter overload for html attributes) to break. Well, that's life with pre-release software.

# September 23, 2008 9:13 AM

John Brennan said:

Cheers Casey, Html.ActionLink was driving me nuts. I couldn't figure out why querystring was not rendering correctly. That error in the constructor overload was a sneaky one.

Thanks again,

John

# October 1, 2008 9:03 PM

Matt said:

Thanks :-)

# November 10, 2008 6:47 PM

Mason said:

The overload for HtmlActionLink was moved to the MvcFutures assembly. Just like it said in the installation readme.

# November 19, 2008 2:15 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Casey Charlton

A somewhat passionate and opinionated developer, with occassional sparks of wisdom, and occasional useful information. Check out Devlicio.us!

Our Sponsors

Red-Gate!