C
C#5d ago
Faker

✅ ADO.Net Vs Entity Framework Core for database connectivity

Hello guys, can someone explain what is the difference between these 2 frameworks please (ADO.Net Vs Entity Framework core). From what I've read, the ADO one is for "low-level" stuff; what do we mean by that? I know that we write raw SQL queries using ADO. Why don't we use EF core? I know EF core contains in-built function that allows us to mimic SQL queries. What can't we do in EF core that can be done in ADO.net? And which framework should I use please. Last thing, I read that EF core is an ORM but ADO.Net isn't, is that correct? This is why we need to write raw SQL queries ?
10 Replies
Pobiega
Pobiega5d ago
ADO.Net isn't a framework as such. Its just a bunch of classes that allow you to connect to SQL databases EF IS a framework, and an ORM. It uses ADO.NET under the hood for some of its connectors.
Nasdack
Nasdack5d ago
research object relational mapping frameworks
Angius
Angius5d ago
Why don't we use EF core
We do
▬▬ι═══════ﺤ
+ forget about Ado.net and use efcore unless you're a very beginner in sql and wanna learn it on the way
Faker
FakerOP5d ago
oh ok yep, did that, from what I understood, the frameworks provide in-built functions like the EF core one; we don't really need to write SQL query like we would do in ADO.Net yep but what about the ADO.Net it's no longer use?
Unknown User
Unknown User5d ago
Message Not Public
Sign In & Join Server To View
Faker
FakerOP5d ago
ah I see the thing is those frameworks, like ER or dapper, uses ADO.Net under the hood even though we don't see it ? By the way, do we have to download anything to use the ADO.Net? I try to import the SqlConnection object by using using System.Data.SqlConnection but it seems SqlConnection is unrecognised when I try to use it
Unknown User
Unknown User5d ago
Message Not Public
Sign In & Join Server To View
Faker
FakerOP5d ago
yep noted
FusedQyou
FusedQyou5d ago
EF is a higher level solution for database communication because it and Dapper just holds your hand a lot more in the end. There's no wrong approach, it's just more convenient. Note that it's actually pretty easy to end up with code that requires you to use the more lower level ADO.NET approach as soon as you need to work with logic that's not directly tied to a class or an existing approach, it's just a lot more convenient.

Did you find this page helpful?