ArticleslgStudy

computer science

Entity Framework

Entity Framework is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Entity Framework rather than just read about it. In short: Entity Framework (EF) is an open source object–relational mapping (ORM) framework for ADO.NET. It was originally shipped as an integral part of .NET Framework, however starting with Entity Framework version 6.0 it has been delivered separately from the .NET Framework.

Entity Framework — main illustration
Entity Framework — illustration

Key takeaways

  • Entity Framework belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Entity Framework to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Entity Framework from memory before moving on to harder problems.

Reference excerpt

Entity Framework (EF) is an open source object–relational mapping (ORM) framework for ADO.NET. It was originally shipped as an integral part of .NET Framework, however starting with Entity Framework version 6.0 it has been delivered separately from the .NET Framework. Entity Framework 6.4 was the latest release of the classic framework. Although Entity Framework 6 is still supported, it is no longer being developed and will only receive fixes for security issues. A new framework known as Entity Framework Core (EF Core) was introduced in 2016 with similar but not complete feature parity. Version numbering of this framework restarted from 1.0.

Overview The Entity Framework is a set of technologies in ADO.NET that supports the development of data-oriented software applications. Architects and developers of data-oriented applications have typically struggled with the need to achieve two very different objectives. They must model the entities, relationships, and logic of the business problems they are solving, and they must also work with the data engines used to store and retrieve the data. The data can span multiple storage systems, each with its own protocols; even applications that work with a single storage system must balance the requirements of the storage system against the requirements of writing efficient and maintainable application code. This problem is generally referred to as the "object–relational impedance mismatch". Many object–relational mapping (ORM) tools (aka "object–relational managers") have been developed to enable developers to work with data in the form of domain-specific objects and properties, such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored. With an ORM, developers can work at a higher level of abstraction when they deal with data, and can create and maintain data-oriented applications with less code than in traditional applications. Entity Framework is the ORM solution currently promoted for use within the Microsoft development stack.

History The first version of Entity Framework (EFv1) was included with .NET Framework 3.5 Service Pack 1 and Visual Studio 2008 Service Pack 1, released on 11 August 2008 (2008-08-11). This version was widely criticized, even attracting a 'vote of no confidence' signed by at least one thousand developers. 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. A third version of Entity Framework, version 4.1, was released on April 12, 2011, with Code First support. 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. Version 4.3.1 was released on February 29, 2012. There were a few updates, like support for migration. Version 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. Version 6.0 was released on October 17, 2013 and is now an open source project licensed under Apache License v2. Like ASP.NET MVC, its source code is hosted at GitHub using Git. This version has a number of improvements for code-first support. Microsoft then decided to modernize, componentize and bring .NET cross-platform to Linux, OSX and elsewhere, meaning the next version of Entity Framework would be a complete rewrite. On 27 June 2016, this was released as Entity Framework Core 1.0, alongside ASP.NET Core 1.0 and .NET Core 1.0. It was originally named Entity Framework 7, but was renamed to highlight that it was a complete rewrite rather than an incremental upgrade and it doesn't replace EF6. Entity Framework Core 1.0 is licensed under Apache License v2, and was built entirely in the open on GitHub. While Entity Framework Core 1.0 shares some conceptual similarities with prior versions of Entity Framework, it was a completely new codebase designed to be more efficient, powerful, flexible, and extensible, running on Windows, Linux and OSX, and supporting a new range of relational and NoSQL data stores. Entity Framework Core 2.0 was released on 14 August 2017 (2017-08-14) along with Visual Studio 2017 15.3 and ASP.NET Core 2.0 Entity Framework Core 3.0 was released on 23 September 2019 (2019-09-23) along with Visual Studio 2019 16.3 and ASP.NET Core 3.0, Entity Framework Core 3.1 (EF Core 3.1) was formally released for production use on 3 December 2019 (2019-12-03) and will be the preferred long-term supported version until at least 3 December 2022. Entity Framework Core 5.0 (EF Core 5) was released for production use on 9 November 2020 (2020-11-09). It was retired and out of support 1.5 years later on May 10, 2022. Entity Framework Core 6.0 (EF Core 6) was released on 10 November 2021 (2021-11-10) and will be the preferred long-term supported version until at least 12 November 2024. Entity Framework Core 7.0 (EF Core 7) was released on 8 November 2022 (2022-11-08) adding features such as JSON columns and bulk updates. Entity Framework Core 8.0 (EF Core 8) was released on 14 November 2023 (2023-11-14) adding features such as Value objects using Complex Types and Primitive collections.

Architecture

The architecture of the ADO.NET Entity Framework, from the bottom up, consists of the following:

… excerpt ends here. Continue reading the full article.

Illustrations

Entity Framework: An Entity Model created using Entity Framework 6 which represents Customer, Order and  Product tables
An Entity Model created using Entity Framework 6 which represents Customer, Order and Product tables

Worked examples

Example 1 — a first encounter with Entity Framework

Start with the simplest possible case. Write down what Entity Framework claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Entity Framework before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Entity Framework ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Entity Framework

In research
Entity Framework appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Entity Framework in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Entity Framework is common in secondary-school and first-year university syllabi. It links to neighbouring topics .NET, .NET object-relational mapping tools, 2008 software, so understanding it makes those chapters shorter.
In everyday life
Look for Entity Framework outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Entity Framework” →

How to study Entity Framework in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Entity Framework means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Entity Framework out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Entity Framework in simple terms?

Entity Framework (EF) is an open source object–relational mapping (ORM) framework for ADO.NET. It was originally shipped as an integral part of .NET Framework, however starting with Entity Framework version 6.0 it has been delivered separately from the .NET Framework.

Why does Entity Framework matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Entity Framework?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Entity Framework.

Tags

  • .NET
  • .NET object-relational mapping tools
  • 2008 software
  • Microsoft free software
  • Object–relational mapping
  • Software using the Apache license

Keep exploring