Entity Framework is an open-source object-relational mapper framework for .NET applications supported by Microsoft. It increases the developer’s productivity as it enables developers to work with data using objects of domain-specific classes without focusing on the underlying database tables and columns where this data is stored. It eliminates the need for most of the data-access code which is used to interact with the database that developers usually need to write. It provides an abstract level to the developers to work with a relational table and columns by using the domain-specific object. It also reduces the code size of the data specific applications and also the readability of the code increases by using it. This is a new technology for accessing the data for Microsoft application. The latest version for Entity Framework is 6.0.
The following figure describes where the Entity Framework present in your application.
The above figure represents how an entity framework interacts with the domain class and database. It provides a connection between the business entity and data tables in the database. It saves data stored in the properties of business entities and also retrieves data from the database and converts it to business entities objects automatically. Entity Framework will execute the relevant query in the database and then materialize results into instances of your domain objects for you to work within your app.
When defining the class and features of entity framework first and then entity framework convert it into the conceptual model first and it creates database and objects in the database from the conceptual model this method is called Code First. Now your object directly works with the database to retrieve or make changes.
Features of Entity Framework
- It is platform independent.
- It uses LinQ queries to manipulate the data in the database instead of SQL queries.
- It keep the track of values that have been changed of the properties of entities.
- It also save changes which are done insert, delete or update operations.
- It also handle concurrency so the data override by a user and will reflect when another use fetches it.
- It also handles transaction management automatically and also provides the customize options for transaction management.
- It provides caching which means it stores the result of the frequently used queries.
- It also follow certain conventions for programming so it by default configure the EF Model.
- It also allows to configure the EF Model by a fluent API to override the default convention.
- If you made any changes in database schema then you can reflect those changes in EF model by writing migration command in CLI(Command Line Interface).
- It also support stored procedure.
- It also support parameterized queries.
- C# | .NET Framework (Basic Architecture and Component Stack)
- Introduction to .NET Framework
- Garbage Collection in C# | .NET Framework
- .NET Framework Class Library (FCL)
- Difference between Python and C#
- Difference between C and C#
- Writing to Excel Sheet Using EPPlus in C#
- Lambda Expressions in C#
- How to Get Started with Game Development?
- Basics of File Handling in C#
- C# | ToolTip Class
- C# | RichTextBox Class
- C# | MaskedTextBox Class
- C# | NumericUpDown Class
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.