Click here to Skip to main content
15,892,005 members
Articles / All Topics

Developer Guide to Entity Framework Part-1

Rate me:
Please Sign up or sign in to vote.
4.60/5 (4 votes)
16 Dec 2015MIT7 min read 8.5K   10  
This is part 1 of developer guide to Entity Framework.

Entity Framework

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 interacts 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 http://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 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. EF7 is scheduled for release alongside ASP.NET 5 in Q1 2016. EF7 is licensed under Apache License v2, and is being built entirely in the open on GitHub. While EF7 shares some conceptual similarities with prior versions, it is a completely new codebase designed to be more efficient, powerful, flexible, and extensible, will run on Windows, Linux and OSX, and will support a new range of relational and NOSQL data stores.

In Summary

Entity Framework started as a tool focused on database developers—and inspired the wrath of agile developers within the .NET community. It learned how to get out of the way of application development and shifted to a Plain Old CLR Objects (POCOs) model, enabling testing and domain-focused software development without disenfranchising data-focused developers. It addressed performance issues and numerous concerns about the quality of generated code, and won over many database administrators (DBAs) along the way. Performance is the bane of many a software project and there has been plenty of criticism of the performance of Entity Framework since its inception. However, each iteration of EF has brought vast improvements in this area.

There are many ORM Framework available, However, if you are a novice developer, Entity Framework may be easiest to learn. Ultimately, the choice is yours.

This is first in a series of articles that are targeted to cover a wide range of topics related to the Entity Framework.

We’ll be posting more articles in the series soon, so stay tuned. You can freely subscribe to this blog for weekly updates on new articles.

References

Image 2

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Business Analyst Luce & Morker
India India
I am an Entrepreneur, co-founder of Luce & Morker, a tech enthusiast, car lover, movie buff and foodie. I write posts for our company blog which are mostly about providing helpful tips, advice, and insights related to web design, web development, web technologies etc.

I love reading articles and I like to keep myself updated with latest tech and business related news.

Comments and Discussions

 
-- There are no messages in this forum --