After doing some reading on ASP.NET MVC I’m ready to start trying it out for myself.
When I’m learning new stuff I want to have a real project to work on. During the past 10 years I have been working on a framework/platform/call it what you want with functionality for Content Management, File management, invoicing, distribution, shopping and so on.
It’s fun and I even have some customers using it.
So when I wanted to learn ASP.NET MVC I started to think about what module in the framework I wanted to start with.

Me and my friends have a whisky society. We meet once in awhile for whisky tastings and have talked about setting up a small website for this. Of course i could use a Starter kit or other open-source applications but this is a perfect project to learn MVC.

The free chapter by Scott Guthrie from Professional ASP.NET MVC 1.0 is a great guide to follow. You can download the PDF here,

Project description
We need a community application with the following functionality to start with:


  • Events
  • User administration and “My Page”
  • Security

Later on we will of course need more functionality sucha as galleries, “my collection”, forum, blog and more. But this is the basics we need to get the site running.

There are many tutorials out there on how to start an MVC project in Visual Studio 2008 so I’m not going through the Visual Studio create project process.
What you should end up with is a project looking like this.

Data model
I will use an SQL Server 2005 database (will upgrade to 2008 later on) and Entity Framework. I haven’t worked with EF that much so this will be a possibility to learn that as well.

I start with creating the database tables. This way of designing the database before the model is one objection many have towards Entity Framework 1.0. But it’s what we have so it’s what we do. Maybe I should have built this in VS2010 and .NET 4.0 but I want to go live this summer so that’s not an option at the moment.
First of all we need a table for our members, I call it Persons. We also need a table for Events an one for the members registered to an event, EventRegistrations. I also set up all foreign key constraints for the EventRegistrations table.

In Visual Studio I then create an ADO.NET Entity Data Model. Entity Framework will then create all the classes for us.

If we change or add something in tha data model we just update the model from the database and our changes will be shown in the class designer.
I also made some changes in the classes after the creation. Since the table names are in plural the classes was the same so I renamed them. I also renamed some of the properties to be more descriptive.

This is a great start and didn’t take a lot of time.

Next time I’ll start looking at the Controllsers and View we need to work with our data.