We’ll start by creating a new ASP.NET MVC 2 Project within
Visual Studio 2010. Choose File->New Project and use the “ASP.NET MVC
2 Empty Web Application” project template to do this.
This will create an empty ASP.NET MVC 2 project that does
not have any controllers, models or views within it:
We’ll next work to define our NerdDinner “model” – which
refers to the objects that represent the data of our application, as well as
the corresponding domain logic that integrates validation and business rules
with it. The model is the "heart" of an MVC-based application,
and fundamentally drives the behavior of it. We’ll create this model
layer using the new EF4 “Code First” capabilities.
Step 2: Create our Model
Let’s assume we do not already have a database defined, and
that we are building our new NerdDinner application completely from scratch.
We do not need to start with a database
When using a code-first development workflow, we do not need
to begin our application by creating a database or specifying schema.
Instead we can begin by writing standard .NET classes that define the domain
model objects that are most appropriate for our application – without having to
worry about intermixing data persistence logic within them.