Republished with Permission - Original Article
People Last month I blogged about the new Entity Framework 4 “code first”
development option. EF “code-first” enables a pretty sweet code-centric
development workflow for working with data. It enables you to:
Work with data without ever having to open a designer or
define an XML mapping file
Define model objects by simply writing “plain old classes”
with no base classes required
Use a “convention over configuration” approach that enables
database persistence without explicitly configuring anything
In my initial blog post I introduced EF “code-first” and
demonstrated how to use the default EF4 mapping conventions to create a new
database. These default conventions work very well for new applications,
and enable you to avoid having to explicitly configure anything in order to map
classes to/from a database. I then did a second custom database schema mapping blog post that discussed how
you can override the default persistence mapping rules, and enable custom
database schemas.
In today’s blog post I’m going to cover a question that
several people asked me recently, which is: “how do I use EF code-first with an
existing database?”