Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADO.NET vs EntityFramework

Can someone please explain the difference between ADO.NET and Entity Framework in layman's terms?
I have searched from Google but can't understand the difference.

ADO.Net means using sqlConnection();, sqlCommand(); etc. to interact with database using queries?
Entity Framework means using db.Add();, db.SaveChanges(); functions to interact with database without using queries? Am I right?

like image 894
Jamshaid Tariq Avatar asked Apr 13 '17 06:04

Jamshaid Tariq


People also ask

Is ADO.NET same as Entity Framework?

The Entity Framework is a set of technologies in ADO.NET that support the development of data-oriented software applications.

Can we use ADO.NET and Entity Framework together?

EF is built on top of ADO.Net, meaning that you can use both at the same time.

What is difference between Entity Framework and LINQ?

Entity Framework is an object-relational mapping (ORM) framework for connecting C# code to external databases, usually SQL Server. LINQ is a query language embedded into C# and a set of extension methods in order to make it useful.


1 Answers

When you use EF db.Add(); or db.SaveChanges or any other integrated EF method, the ORM (object-relational mapper), in this example EF, will use ADO.NET (so EF will open database connection using ADO.NET, EF will create "SQL query" using ADO.NET,...).

Of course, you can do this all by yourself, using ADO.NET methods, which sometimes can increase the performance of the queries, but usually needs more code writing.

But in general, when you use EF, you also use ADO.NET, only its implemented inside EF methods.

like image 68
tadej Avatar answered Sep 28 '22 02:09

tadej