Entity Framework VS Ado.net

What is the main difference between ADO.net and Entity Framework?

Why should we use Entity Data Model instead of Commands and Datasets?

+6
source share
2 answers

The essence of ADO.NET is ORM (Relational Object Mapping), which creates a higher abstract object model over ADO.NET components. Therefore, instead of entering a data set, data objects, commands, and connection objects, as shown in the code below, you work on objects of a higher level of the domain, such as customers, suppliers, etc.

DataTable table = adoDs.Tables[0]; for (int j = 0; j < table.Rows.Count; j++) { DataRow row = table.Rows[j]; // Get the values of the fields string CustomerName = (string)row["Customername"]; string CustomerCode = (string)row["CustomerCode"]; } 

Below is the code for the Entity Framework, in which we work on objects of a higher level, such as a client, and not with the basic levels of ADO.NET components (such as a dataset, datareader, command, connection objects, etc.).

 foreach (Customer objCust in obj.Customers) {} 

The main and only advantage of EF is the automatic creation of code for the model (middle level), data access level and display code, which reduces development time.

here

+6
source

I think this question is misleading. Entity Framework is a wrapper for ADO.NET. Thus, there is practically no difference between these two characteristics (perhaps the structure of entities is slightly slower). What you use depends entirely on your preferences. Currently, I am using the Entity framework for almost everything related to the database, because it seems that it is much easier and faster to get what you need.

+2
source

Source: https://habr.com/ru/post/979040/


All Articles