Microsoft’s principal data access technology, ADO.NET Entity Framework, has had
two major releases as part of the .NET Framework. NET 3.5 brought us the first version
of Entity Framework, which is covered in the first edition of Programming Entity
Framework. In 2010, Microsoft .NET 4 was released; it contained the next version of
Entity Framework, referred to as Entity Framework 4. The completely revised second
edition of Programming Entity Framework was dedicated to teaching readers how to
use this version of Entity Framework in Visual Studio 2010.
When .NET 4 was released, the Entity Framework team was already hard at work on
a new addition, called Code First, to provide an alternative to building the Entity Data
Model that is core to Entity Framework. Rather than using a visual designer, Code First
allows you to create the model from your existing classes.
This book is dedicated to teaching readers how to use Code First to build and configure
a model based on the classes in your business domain. While Code First can do much
of the job of inferring a model from your classes, there is quite a lot that you can do to
affect the model that Code First creates.
In this book, you will learn what Code First does by default (aka convention) and how
to perform further configuration to affect how it understands your properties, classes,
relationships, and the database schema they map to—whether you use Code First to
help create a database or you want to use it with an existing database. With this knowledge,
you can reap the benefits of the Entity Framework while leveraging existing classes
or those classes you might be building for a new software project.