Filed: ASP.NET MVC 3 Tutorials, Training, and Videos
In the previous tutorial, ASP.NET MVC 3 Scaffolding with Entity Framework - Code Generation, I showed how to use the new Add Controller Dialog provided in the ASP.NET MVC 3 Tools Update to scaffold CRUD Actions and Views with Entity Framework. In that example we added an ADO.NET Entity Data Model to the ASP.NET MVC 3 Web Application, created a Book Model within the Visual Designer, and had the designer generate the tables for us. This worked very well and we had a simple ASP.NET MVC 3 Web Application running in minutes.
In this example, we are going to use EF Code First to accomplish the same results.
EF Code First and ASP.NET MVC Scaffolding of CRUD Actions and Views
Create an ASP.NET MVC 3 Web Application in Visual Studio 2010 and add two classes, called Book and Library. Book is just a plain 'ol POCO, and Library derives from DbContext in the System.Data.Entity Namespace.

Add a ConnectionString to the Web.Config with the same name as the custom DbContext Class, Library. This tells Entity Framework where to store and retrieve books. ( Note: If you don't add a connectionstring, EF will automatically create the database for you using SQL Server Express unless you specify a different Connection Factory. I already had a database created from the previous tutorial, so I used it for convenience. )

Once complete, perform the exact steps as explained in the previous tutorial. Right-click on the Controllers Folder in the ASP.NET MVC Web Application and choose Add -> Controller... from the menu. Thanks to the ASP.NET MVC 3 Tools Update, the Add Controller Dialog now has an option to generate a CRUD Controller using Entity Framework.

Choose Book as the Model class and Library for the Data context class. Choose either Razor, WebForms, or other desired view engine for ASP.NET MVC 3.
Click the Add Button and the code generation template ( T4 Template ) will generate a BooksController with CRUD Actions as well as a view for each action in your Visual Studio 2010 Solution:

Once the code generation is complete, add a Books Tab to your _Layout.cshtml ( or equivalent ) view so it shows on the main menu and run the ASP.NET MVC 3 Web Application. You will see simple CRUD Views to create, read, update, and delete books in the library.

Conclusion
In the next tutorial we will try this again using a similar, but slightly more complex model. This ASP.NET MVC 3 Tutorial and other tutorials can be found in my list of ASP.NET MVC 3 Tutorials.
David Hayden