What is Entity Framework (EF)

Entity Framework (EF) is an Object/Relational mapping (ORM) framework and is a set of technologies for developing applications that interact with data. A .NET developer spends a lot of time keeping up with the database changes. Entity Framework provides a mapping from the relational database schema to the objects and offers an abstraction. In Entity Framework, you can define Entity classes that are independent of a database structure and then map them to the tables and associations of the database. Since we are now working with Entities which have their own schema, we are shielded from the changes in the database. The object context keeps tabs on the entities that are changed. Entity Framework provides a shift from Database-oriented (DataReader, DataSet) to Model-oriented development. So instead of focusing on a Database, a developer focuses on the Entity that represents the Business Model of the application.

History of Entity Framework Version

Announced in TechEd 2006, the first version of Entity Framework 3.5 was released two years later in August 2008, along with Visual Studio 2008 SP1 and .NET 3.5 SP1. This release provided basic O/RM support using the Database First workflow. This version was met with exceptional controversy. Few infrastructure products have provoked a Vote of no confidence petition signed by almost a thousand developers, including a couple of dozen MVPs. The key criticism was aimed at the clumsiness of writing modern, clean code: the entity classes had to be populated with boilerplate code, lazy loading was a pain to implement and the advertised disconnect between data model and a business-driven entity model was relatively cumbersome to achieve.

An extra insult was added by the launch date: .NET 3.5 and Visual Studio 2008 shipped without Entity Framework, as Microsoft simply missed the deadline. After the November 2007 release, it took an additional year to push out Entity Framework with .NET 3.5 Service Pack 1. With this delay, many had already clung on to the “simplified EF” LINQ to SQL shipping with .NET 3.5 – or competing ORM products. And to further mess things up, it was then announced that development focus would be on EF. People read this as having the LINQ to SQL project terminated – perhaps a slightly dramatized conclusion, but not entirely baseless.

The second version of Entity Framework, named Entity Framework 4.0 (EFv4), was released as part of .NET 4.0 on 12 April 2010 and addressed many of the criticisms made of version 1. New features in this release included POCO support, lazy loading, testability improvements, customizable code generation and the Model First workflow. Although it was the second release of Entity Framework it was named EF 4 to align with the .NET Framework version that it shipped with.

A third version of Entity Framework, named Entity Framework 4.1, was released on April 12, 2011, with Code First support and simplified DbContext API. This release was available on NuGet and adopted semantic versioning since it was no longer tied to the .NET Framework Version.

A refresh of version 4.1, named Entity Framework 4.1 Update 1, was released on July 25, 2011. It includes bug fixes and new supported types. In addition to bug fixes this patch release introduced some components to make it easier for design time tooling to work with a Code First model.

Entity Framework 4.2 was released on November 1, 2011. It includes bug fixes and adopt the https://semver.org standard for semantic versioning.

Entity Framework 4.3 was released on February 9, 2012. This release included the new Code First Migrations feature that allows a database created by Code First to be incrementally changed as your Code First model evolves.

A patch of version 4.3, named Entity Framework 4.3.1, was released on February 29, 2012. This patch release included some bug fixes to the EF 4.3 release and introduced better LocalDb support for folks using EF 4.3 with Visual Studio 2012.

Entity Framework 5.0.0 was released on August 11, 2012 and is targeted at .NET framework 4.5. Also, this version is available for .Net framework 4, but without any runtime advantages over version 4. This release can be used in Visual Studio 2010 and Visual Studio 2012 to write applications that target .NET 4.0 and .NET 4.5. When targeting .NET 4.5 this release introduces some new features including enum support, table-valued functions, spatial data types and various performance improvements. The Entity Framework Designer in Visual Studio 2012 also introduces support for multiple-diagrams per model, coloring of shapes on the design surface and batch import of stored procedures.

Entity Framework 6.0 was released on October 17, 2013 and is now an open source project licensed under Apache License v2. This version has a number of improvements for code-first support. This release can be used in Visual Studio 2013, Visual Studio 2012 and Visual Studio 2010 (runtime only) to write applications that target .NET 4.0 and .NET 4.5. This release included asynchronous query support, testability improvements, logging enhancements, stored procedure support in Code First, code based configuration and general performance improvements.

Entity Framework 6.0.1 patch release is limited to fixing issues that were introduced in the EF6 release (regressions in performance/behavior since EF5). This is a runtime only release, there was no update to the tooling. The most notable changes were to fix some performance issues during warm-up for EF models. This was important as warm-up performance was an area of focus in EF6 and these issues were negating some of the performance gains made in EF6.

Entity Framework 6.0.2 patch release is limited to fixing issues that were introduced in the EF6 release (regressions in performance/behavior since EF5). This patch includes fixes to some performance and functional issues that were introduced in the 6.0.0 and 6.0.1 releases.

Entity Framework 6.1.0 is a minor update to Entity Framework 6. It includes various new features and a few bug fixes. This release included Tooling Consolidation, Handling of Transaction commit failures, Indexing, Public Mapping API, Interceptor Configuration, and improved performance.

Entity Framework 6.1.1, Entity Framework 6.1.2, and Entity Framework 6.1.3 are bug fixes releases only.

Entity Framework Core 1.0 (aka EF Core 1.0) initially available as Entity Framework Version 7 (EF7) is currently being built as part of Microsoft’s efforts to modernize, componentize and bring .NET cross-platform to Linux, OSX and elsewhere. The vision for EF Core is “a core framework that handles concepts common to most data stores with provider specific extensions that become available when you target a specific provider”. EF Core is much more lightweight than previous versions and is built from the ground up to work great in the cloud (using ASP.NET vNext) on devices (i.e. in universal Windows apps) as well as in traditional .NET scenarios.

Important Features of Entity Framework Core

[TestMethod]
public void SampleTest()

{
var options = new DbContextOptions()
.UseInMemoryStore();
using (var db = new StoresContext(options))

{

//Code to perform CRUD operations
//Assert the results

}
}

Constraints

Leave a Reply

Your email address will not be published. Required fields are marked *