What’s new in Entity Framework from beginning to EF7 – EF Core

By | September 24, 2014

Microsoft Entity Framework (EF) is an Object Relational Mapping framework that provides an abstraction layer (a kind of mapping) between two incompatible systems (i.e. Object oriented programming languages with Relational databases). It enables us to interact with relational data in an object oriented way.

UPDATED: Web Development Tutorial is updated with the release of Entity Framework EF7 also rebranded as Entity Framework Core 1.0. including the key features of latest version of Entity Framework.

Let’s have a quick look into most important and exciting new features introduced in different versions of Microsoft Entity Framework.Entity Framework 6

You can get a comprehensive list of Entity Framework Interview Questions here.

First version of Entity Framework was introduced with .NET Framework v3.5 Service Pack 1. Basic Object Relational Mapping support was given in this version.

You are developing an ASP.NET MVC application. The application is an order processing system that uses the ADO.NET Entity Framework against a SQL Server database. It has a controller that loads a page that displays all orders along with customer information. Lazy loading has been disabled. The Order class is shown below.

public partial class Order

public string CustomerID { get; set; }

public virtual Customer Customer { get; set; }
You need to return the orders and customer information in a single round trip to the database.
Which code segment should you use?

  • A.
    public ActionResult Index()
    IQueryable orders = db.Orders;
    orders = orders.Include(“Customer”);
    return View(orders.ToList());
  • B.
    public ActionResult Index()
    IQueryable orders = db.Orders.Include(“Order.Customer”);
    return View(orders.ToList());
  • C.
    public ActionResult Index()
    IQueryable orders = db.Orders;
    orders.Select(o => o.Customer).Load();
    return View(orders.ToList());
  • D.
    public ActionResult Index()
    IQueryable orders = db.Orders;
    return View(orders.ToList());

For a complete online test and Practice Exams on Web Technologies, Click Here.

 Correct Answer: C

New Features in Entity Framework 4

Entity Framework 4 was actually second version but named as EF 4 to align with .NET Framework v4.0 and Visual Studio 2010 having the following new features including all major and minor versions of Entity Framework i.e. 4, 4.1, 4.1.1, 4.2, 4.3 and 4.3.1.

  • Support for POCO – Plain Old CLR Objects that decouples it from any persistence technology.
  • Lazy Loading – On demand loading of related entities.
  • Code Generation – Customizable code generation templates.
  • Support for Model First Development – We first create model of entities and later on generate script for corresponding database tables and relations using Visual Studio 2010.
  • DbContext API provides simplified abstraction over ObjectContext.
  • Code First Development – Conceptual model can be created by writing classes.
  • Code First Migration facilitates incremental migration of database created by code first development.

New Features in Entity Framework 5

Entity Framework 5 targets both .NET 4 as well as .NET framework 4.5 with following new features.

  • Enum Support – enum properties supported in entity classes with EF5.
  • Spatial Data Types – support for working with Spatial data using DbGeography and DbGeometry classes.
  • Support for Table-Valued functions of SQL Server that are just like stored procedures with one key difference and that difference is TVF result can be used in a LINQ query.
  • Performance Enhancements – around 65% to 70% performance improvment over Entity Framework 4.

New Features in Entity Framework 6

This version of Entity Framework is available with Visual Studio 2013 but we can download EF 6 for Visual Studio 2012 too.

  • Code-based configuration support along with traditional XML-based configuration support.
  • Most exciting feature of Entity Framework 6 is asynchronous support i.e support for asynchronous queries and save. Asynchronous feature is introduced in .NET 4.5. WCF 4.5 also supports asynchronous programming.
  • Logging Enhancements – logging of database commands helps to understand what’s going on while interacting with data.
  • Support for stored procedure mapping to different operations like insert, update, delete.
  • Testability Improvements.
  • Custom Code First Conventions helps to customize default conventions.

New Features in Entity Framework Core 1.0 or EF7

Entity Framework Core 1.0 is a lightweight, open-source and extensible framework for targeting .NET Core applications with more exciting features as follows:

  • Cross Platform i.e. can work with .net core application built for MacOS or Linux.
  • Designed for disconnected/web services.
  • Entity Framework Core is cloud optimized.
  • EF Core is Device Optimized as being lightweight can work with SQLite.
  • Support for relational and non-relational databases.
ASP.NET Core with Angular 2
Build a Real-world App with ASP.NET Core and Angular 2 (4+)

  • Build a full-stack web app with ASP.NET Core, Entity Framework Core and Angular 2 & 4.
  • Implement a Clean & Decouple Architecture.
  • Properly implement the repository and unit of work patterns.
  • Troubleshoot common runtime errors.
  • Test APIs using PostMan.
  • Integrate ASP.NET MVC/Core with Angularjs.
  • Understand and apply the Dependency Inversion Principle (DIP).
  • Use the new dependency injection feature in ASP.NET Core.
  • Build APIs with ASP.NET Core
  • and more….

Take this Online Course at Discounted Price

The Entity Framework Tutorial discussed key and interesting new features of Entity Framework but for a complete list of new features and enhancements about this technology, please visit Microsoft  Entity Framework Documentation.

Other Related Articles:

Exam 70-486

Top 10 Interview Questions and Answers Series: