Wednesday, November 19, 2008

Upgrading Suteki Shop to the MVC Framework Beta


I've just gone through the process of upgrading Suteki Shop, my open source eCommerce application from MVC Framework Preview 4 to the Beta. Yes, I know, I missed out Preview 5 all together, so my experiences are going to be different from someone just moving from Preview 5 to the Beta.

Here's a brief rundown of what was involved:

  1. Download and install the MVC Beta
  2. Get the latest MvcContrib trunk and build it. It already references the MVC Beta assemblies, so there's no need to copy them in.
  3. Copy all the MVC Beta, MvcContrib and Castle assemblies into my 'Dependencies' folder.
  4. Make sure all the MVC Beta assemblies are marked as 'Copy Local'. I don't want to have to install them in the GAC on my server.

Now as expected, when I built the solution I got a ton of exceptions. Here's what I needed to do to get it to build:

  1. Most HtmlHelper extension methods have been moved to the System.Web.Mvc.Html namespace, so I had to add a using statement to any file which referenced ActionLink.
  2. ActionLink<T> now lives in the futures assembly: 'Microsoft.Web.Mvc' so I had to add using statements where appropriate.
  3. I had to add my own implementation of 'ReadFromRequest' to my own ControllerBase class as this has been removed from Controller.
  4. I had to fully qualify the namespace of my ControllerBase class because there is now a ControllerBase in the MVC Framework.

I also had to make the following changes to the Web.config file:

  1. Change the version number of System.Web.Abstractions to
  2. Change the version number of System.Web.Routing to
  3. Add the namespace 'System.Web.Mvc.Html'

There were also some changes to the views:

  1. Html.Form has been renamed to Html.BeginForm.
  2. Html.Checkbox's signature has been changed.

With all the changes made the software now builds and runs. But that's not the end of the story. It works, but it's coded in a very Preview 1 style. I'm planning to do a major refactoring over the Christmas holidays to use all the Beta goodness that been introduced and that will mean changing the way most of the controllers work and re-doing most of the views. Should be fun :P


Unknown said...

Great news Mike, I am really keen to get my mits into this in the new year. Keep up the good work!

Mike Hadlow said...

Thanks Rhys,

It's upated to Beta in Google Code, but a bit buggy still. I'm planning to put a solid week into it over the Christmas holidays.

Xiong Chen said...

Does Suteki support digital download products? If not it would be nice to add this function.

Mike Hadlow said...

Hi John,

No it doesn't support digital downloads at present. I agree that that would be a nice feature. If you go ahead and implement it, be sure to send me a patch!