C
C#2mo ago
Faker

✅ EF Core "Disconnected" Architecture Vs Ado.NET

Hello guys, can someone explain how EF core works under the hood please. I read that it just loads data in memory, everything is done in memory and all changes are made to the database when we use method like SaveChanges(). But it may happen we don't need that method either like when we use the ExecuteDelete or ExecuteUpdate (I think, don't know how this works though). I was wondering how is this different from ADO.Net; in ADO.Net we have a choice of connected and disconnected architecture? Like I know we can use DbSet I think to load entire entity in it, then work from that. I would really appreciate if someone can clarify how both the EF Core and ADO.Net architecture works :C
9 Replies
Jimmacle
Jimmacle2mo ago
EF's database connections are abstracted away from you, they're pooled and reused as necessary i don't know exactly what you mean by "everything is done in memory," as much is done in memory as you would with ADO.NET and manually mapping to C# objects EF has a change tracker which allows it to automatically determine what you did to tracked objects and generate appropriate SQL to make those changes in the database
Faker
FakerOP2mo ago
oh, I thought, we were modifying the database directly rather than using mapped objects
wasabi
wasabi2mo ago
The entire point of EF is to map objects. It is an ORM. Object Relational Mapper.
Jimmacle
Jimmacle2mo ago
ADO.NET is the common denominator, it's just how you access databases in C# EF is a bunch of extra stuff built on top of that to make your life easier so you don't have to implement it yourself you can reimplement the entirety of EF in your own program using just ADO.NET if you wanted, but there would be no point because EF and other flavors of ORM already exist dapper is also a layer on top of ADO.NET, albeit a much thinner one
Faker
FakerOP2mo ago
yeah I see, is ADO.Net considered an ORM?
Jimmacle
Jimmacle2mo ago
no it has no functionality to map between raw SQL data and C# objects (besides primitives)
Faker
FakerOP2mo ago
yeahh I see, it's clearer now
wasabi
wasabi2mo ago
Other than Typed data sets. Never use those. Forget I said anything.
Faker
FakerOP2mo ago
Noted, thanks guys !

Did you find this page helpful?