Upgrading Yonkly to ASP.NET MVC Preview 3

I just spent this morning upgrading the Yonkly code to work with the newly released ASP.NET MVC Framework Preview 3.  I thought I would document what I did here, so that it might help others trying to upgrade their projects.  Note: I haven’t deployed the upgraded version to yonkly.com but released the source code.

Setup

Yonkly was running on the preview-of-preview version from codeplex (more info here).

I downloaded and installed the preview 3 version from here.

I removed the references in my project to System.Web.Abstractions, System.Web.Mvc and System.Web.Routing and re-added them from

C:Program FilesMicrosoft ASP.NETASP.NET MVC Preview 3Assemblies

ViewData

ViewData works different now.  If your page/control uses a typed ViewData as in

public partial class Messages : ViewPage <BaseViewData>

then ViewData property of your page is not of type BaseViewData as it were in the previous version.  Instead this.ViewData is of type ViewDataDictionary<BaseViewData>.

image

This change is a pain in the ass, but I like it.  It gives me the ability to send information to the View Data as dictionary items as well as typed objects.  The actual typed “view data” can be accessed through the Model property i.e. this.ViewData.Model

image

Change #1: I changed all my ViewData.[property] to ViewData.Mode.[property] throughout the project (don’t forget the ascx and aspx pages).

JsonResult

JsonResult class added to the framework.  This is cool but unfortunately, I hade a class with the same name.

Change #2: Resolve naming conflicts with JsonResult class.

RenderView

RenderView isn’t party of the controller class any more and has been replaced by View

Change #3: Replace all RenderView calls to View

Issues

I was also having problems with the routing until I took out my default.aspx route.  It seems that everything is working out good.  I will post any more conversion related problems here and if you have some of your own, please share.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s