Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework VS Ado.net [duplicate]

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

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

like image 785
Zulqarnain Ejaz Avatar asked Dec 03 '14 11:12

Zulqarnain Ejaz


People also ask

Is ADO.NET faster than EF?

Performance: ADO.NET is much faster compared to the Entity Framework. Because ADO.NET always establishes the connection directly to the database. That's why it provides much better performance compared to the Entity Framework.

What are the differences between the ADO.NET and Entity Framework?

Entity framework is ORM Model, which used LINQ to access database, and code is autogenerated whereas Ado.net code is larger than Entity Framework. Ado.net is faster than Entity Framework. 1. ADO.Net is create bunch of data layer code, EF is not create.

Is EF core faster than ef6?

The conclusions are obvious: in almost every test conducted by Chad, Entity Framework Core 3 is faster than Entity Framework 6 – exactly 2.25 to 4.15 times faster! So if performance is important to your application and it operates on large amounts of data, EF Core should be a natural choice.

Why Dapper is faster than Entity Framework?

Dapper vs Entity Framework Core Dapper is literally much faster than Entity Framework Core considering the fact that there are no bells and whistles in Dapper. It is a straight forward Micro ORM that has minimal features as well.


2 Answers

ADO.NET entity is an ORM (object relational mapping) which creates a higher abstract object model over ADO.NET components. So rather than getting into dataset, datatables, command, and connection objects as shown in the below code, you work on higher level domain objects like 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 Entity Framework in which we are working on higher level domain objects like customer rather than with base level ADO.NET components (like dataset, datareader, command, connection objects, etc.).

foreach (Customer objCust in obj.Customers)
{}

The main and the only benefit of EF is it auto-generates code for the Model (middle layer), Data Access Layer, and mapping code, thus reducing a lot of development time.

here

like image 166
midhu458 Avatar answered Sep 23 '22 18:09

midhu458


I think the question is kind of misleading. Entity Framework is a wrapper for ADO.NET. Thus there is nearly no difference between those two in performance (maybe entity framework is a bit slower). What you use depends totally on your preference. Im currently using Entity framework for nearly everything related to database because it seems much simpler and faster to get what you need.

like image 33
Boris Bucek Avatar answered Sep 23 '22 18:09

Boris Bucek