Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Upgrading Dimecasts.Net from MVC Preview 4 to Preview 5

Like many other nerds (sorry people, lets face we are nerds :) ), as soon as I heard that MVC Preview 5 had been released I wanted to run out and upgrade Dimecasts.net. 

Let me first start off by saying this.  Anyone that decides to build a production application of any size on a Technology Preview must be willing to accept breaking changes between releases.  Please do not take this post as me 'bitching' or 'complaining'.  This post is just to help others that may be about to do the same thing.

Here are the conversion issues I ran into:

Issue #1:
Since the new assemblies are now versioned again I needed to update the web.config to reflect 3.5.0.0

Solution:
Spend 3 seconds changing the web.config

Issue #2:
The decision was made by the MVC team to remove RenderUserControl and replace it with a more generic RenderPartial.  Now they both do the same thing in principal, but act in a slightly different way.  Because RenderPartial does not return any html (it writes it directly to the output stream) you need to change the syntax to call it.

Solution:
Replace all instances of RenderUserControl with RenderPartial as well as change the syntax.

Old Syntax
<% = Html.RenderUserControl(......) %>

New Syntax
<% Html.RenderPartial(......); %> // No = sign and added ;

Issue #3:
The HTML Helper ActionLink was changed to no long support the use of generics/lambda expressions.  This was done because you can not assume route information based on generics/lambdas and this could cause issues in the future

Solution:
Make the needed and painful change all over the code.

Issue #4:
Most of the HTML Helper's for text entry (text box, text area, etc) was changed to no longer accept html attributes such as width, height, cols, etc.  This was done with good intent and was the right move.

Solution:
Now in order to supply html attributes you need to use the overload that allows you to provide an anonymous object with the information.

ie -- new { width = 25, height = 20 }

 

All in all the upgrade was not all that painful.  I think it took me about 1 hour, nothing major.  Actually took me about as long to regression test the site as it did to make the actual changes.

I hope this helps someone else that is making the change.

Till next time,

[----- Remember to check out DimeCasts.Net -----]


Posted 09-03-2008 6:49 AM by Derik Whittaker
Filed under:

[Advertisement]

Comments

Ben Scheirman wrote re: Upgrading Dimecasts.Net from MVC Preview 4 to Preview 5
on 09-03-2008 9:21 AM

The lambda's for Html.ActionLink still exist in Microsoft.Web.Mvc.dll ... though I understand that they might not be able to address all route (due to ActionInvoker changes) they are still very powerful for use in refactoring and compile safety.

If these end up going away I will be very tempted to drop ASPX view engine in favor of NVelocity, since it is so much more concise.

Derik Whittaker wrote re: Upgrading Dimecasts.Net from MVC Preview 4 to Preview 5
on 09-03-2008 9:28 AM

@Ben,

I looked over in Microsoft.Web.Mvc, but must have missed it.  I will take a look again.

Thanks,

Nick Berardi wrote re: Upgrading Dimecasts.Net from MVC Preview 4 to Preview 5
on 09-03-2008 10:46 AM

created this RegEx find and replace all the older RenderUserControl's for Visual Studio

\<%= Html.RenderUserControl\({[^\)]*}\)[ ]*%\>

with

<% Html.RenderPartial(\1); %>

Steve Gentile wrote re: Upgrading Dimecasts.Net from MVC Preview 4 to Preview 5
on 09-04-2008 12:44 PM

One option is to wrap their controls inside your own.  This way, you can minimize the amount of breaking changes from preview to preview.

I used to do the same with webforms.  

I think more intuitive work needs to occur with the model binder stuff - more like Monorail does it would be preferred for me.

Dave Schinkel wrote re: Upgrading Dimecasts.Net from MVC Preview 4 to Preview 5
on 09-06-2008 3:25 PM

Totally agreed.  

For example you don't build out an entire white-box  Company portal API for 5+ divisions for a mid-to-large company that has 40,000 some users based on MVC.  You wait until it's mature enough.  But if you enjoy your weekends loving your PC and no life, go right ahead.

Tim Barcz wrote Upgrading to MVC Preview 5 - System.Web.Routing problem
on 09-22-2008 10:55 PM

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

Community Blogs wrote Upgrading to MVC Preview 5 - System.Web.Routing problem
on 09-22-2008 11:33 PM

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

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)