Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4110502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:56:33+00:00 2026-05-20T21:56:33+00:00

What are the pros & cons of using Entity Framework 4.1 Code-first over Model/Database-first

  • 0

What are the pros & cons of using Entity Framework 4.1 Code-first over Model/Database-first with EDMX diagram?

I’m trying to fully understand all the approaches to building data access layer using EF 4.1. I’m using Repository pattern and IoC.

I know I can use code-first approach: define my entities and context by hand and use ModelBuilder to fine-tune the schema.

I can also create an EDMX diagram and choose a code generation step that uses T4 templates to generate the same POCO classes.

In both cases I end up with POCO object which are ORM agnostic and context that derives from DbContext.

Database-first seems to be most appealing since I can design database in Enterprise Manager, quickly synch the model and fine-tune it using the designer.

So what is the difference between those two approaches? Is it just about the preference VS2010 vs Enterprise Manager?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:56:33+00:00Added an answer on May 20, 2026 at 9:56 pm

    I think the differences are:

    Code first

    • Very popular because hardcore programmers don’t like any kind of designers and defining mapping in EDMX xml is too complex.
    • Full control over the code (no autogenerated code which is hard to modify).
    • General expectation is that you do not bother with DB. DB is just a storage with no logic. EF will handle creation and you don’t want to know how it does the job.
    • Manual changes to database will be most probably lost because your code defines the database.

    Database first

    • Very popular if you have DB designed by DBAs, developed separately or if you have existing DB.
    • You will let EF create entities for you and after modification of mapping you will generate POCO entities.
    • If you want additional features in POCO entities you must either T4 modify template or use partial classes.
    • Manual changes to the database are possible because the database defines your domain model. You can always update model from database (this feature works quite well).
    • I often use this together VS Database projects (only Premium and Ultimate version).

    Model first

    • IMHO popular if you are designer fan (= you don’t like writing code or SQL).
    • You will “draw” your model and let workflow generate your database script and T4 template generate your POCO entities. You will lose part of the control on both your entities and database but for small easy projects you will be very productive.
    • If you want additional features in POCO entities you must either T4 modify template or use partial classes.
    • Manual changes to database will be most probably lost because your model defines the database. This works better if you have Database generation power pack installed. It will allow you updating database schema (instead of recreating) or updating database projects in VS.

    I expect that in case of EF 4.1 there are several other features related to Code First vs. Model/Database first. Fluent API used in Code first doesn’t offer all features of EDMX. I expect that features like stored procedures mapping, query views, defining views etc. works when using Model/Database first and DbContext (I haven’t tried it yet) but they don’t in Code first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

TLDR: What are the pros/cons of using an in-memory database vs locks and concurrent
I would like to use an IDE for PHP Development using Zend framework &
I'm using the phrases Parallel Processing & Multi Threading interchangeably because I feel there
using java.nio one has to register interest in operations via the SelectableChannel: SelectionKey =
I am using Visual Studio Team System 2008 and see it has an Icon
Pre-compiled headers seem like they can save a lot of time in large projects,
Can anybody please put some light on the need of the method getTypeInstance(), which
Duplicate of about 20 recent questions; someone please link them. For simple scenarios when
I am currently writing a template for OpenCms, a Java based CMS with a
Apologies in advance if this is a silly question but I'm wondering which might

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.