Using EF “Code First” with an Existing Database
page 1 of 15
Published: 03 Aug 2010
Unedited - Community Contributed
Abstract
In this article, Scott examines the usage of Entity Framework "Code First" with an existing database in a series of steps. He initially provides a detailed overview of the various steps with the help of relevant screenshot and then examines POCO Model Classes, Nullable Columns, Association Properties, Lazy Loading including the usage of model classes. Towards the end of the article, Scott covers few additional code examples.
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 16761/ 170

Introduction

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?”


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 9/21/2014 2:08:58 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search