ADO.NET Entity Framework is an Object/Relational Mapping (ORM) framework that enables developers to work with various relational databases like SQL Server, Oracle, DB2, MYSQL etc. It enables developers to deal with data as business objects and entities. Using the Entity Framework, developers issue queries using LINQ, then retrieve and manipulate data as strongly typed objects using C# or VB.NET.

Access a relational data base with strongly-typed LINQ Queries.

Code First :

Very popular because hard core programmers don’t like any kind of designers and defining mapping in EDMX xml is too complex. Full control over the code (no auto generated 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 do 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 good).

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 to generate your database script and T4 template to generate your POCO entities. You will lose part of 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.

Entity Framework Versions :

ADO.NET Entity Framework Version Supported Framework & IDE Features Detail
3.5 .NET Framework 3.5 SP1 and Visual Studio 2008 SP1
  • This release provided basic O/RM support using the Database first development.
4.0 .NET Framework 4.0 and Visual Studio 2010
  • Model-first development
  • POCO support
  • Lazy Loading
  • T4 Code Generation
4.1 .NET Framework 4.0 and Visual Studio 2010
  • Code First development
  • Introduced DbContext API
  • Data Annotations and Fluent API Validation
4.2 .NET Framework 4.0 and Visual Studio 2010
  • The EF 4.2 release included the bug fixes to EF 4.1
4.3 .NET Framework 4.5 and Visual Studio 2012
  • Code First Migrations
  • Automatic Migrations
5.0 .NET Framework 4.5 and Visual Studio 2012
  • Enum Support in Code First and EF Designer
  • Spatial Data Types in Code First and EF Designer
  • Table-Valued Functions
  • Multiple Diagrams per Model
6.0 .NET Framework 4.5.1 and Visual Studio 2013
  • Async Query and Save
  • Code-Based Configuration
  • Dependency Resolution
  • Interception/SQL logging
  • Improved Connection Management
  • Improved Transaction Support
7.0 .Net Framework 5.0 or ASP.Net Core 1.0 and Visual Studio 2015/2017
  • Handling of detached Entities
  • Improvements for Eager Loading & Batching
  • Support Cascade Delete
  • Shadow Properties
  • Built-in Logging
  • Support for unit testing

 

Happy Coding 🙂