I love learning new things connected to software development – and anything that has the potential to save me time is always high up on the list of things to investigate. After all, time is money – either for yourself when you are a contractor, or your employer if you are an employee!

I’m sure you all have been using MVC (Model View Controller) structures for a while now, but I’ve only recently started looking at the “Scaffolding” approaches that are out there – these are quick, simple ways of building, essentially, your prototype application based only on the base models. So you create one class, and the Scaffolding framework builds the views, and the controller for you. Job done. Oh, and it also sorts out the persistence (read: database) for your models too.

Sound like its too good to be true?

Well, I’m not going to say its perfect, in fact, it seems to have some insanely annoying “defaults” – some of which I’m going to introduce you to while we go through this introduction to Scaffolding over the next few days / posts.

First off we need to install the scaffolding stuff – the easiest way to do this is to use NuGet in Visual Studio 2010.

Create a new MVC 3 Razor project (my preference!).

Open up the Package Manager Console, and type in:

Install-package mvcscaffolding

Sit back and wait while the packages are installed. A reference to the scaffolding libraries will be added to your project automatically.

Now, I’ll go into actually using the scaffolding library in my next post, but first, I want to bring your attention to, what in my opinion, is one of the most annoying things about this library.

It uses Entity Framework Code First (EF Code First). Basically this is a wrapper for Entity Framework that lets you write your models and have it handle the generation of the database schema around Entity Framework. So far so good. But it looks for an instance of SQLExpress. Total pain in the ass in my case, as I don’t have it installed as “SQLExpress” … so it fails out of the box. Wonderful.  There isn’t a nice way that I’ve found to change this across the board, so you are down to changing it per project. Again, I’ll cover this on my next post, as you really need to have at least one Model “scaffolded” first so you know what context names etc will be used.