C
C#2y ago
surwren

When to use EF queries, LinQ, or MySQLClient

Attached is one of the Entity Framework (EF) queries I'm referring to (I'm not sure if this is what it's actually called). Assuming you're building an app from scratch, in which contexts does each one perform best/worst? I'm really confused because it seems that you can do basically everything by opening connections and passing SQL queries with MySQLClient, so there must be some advantages to EF or LinQ
10 Replies
surwren
surwren2y ago
I'm told that EF comes with migrations and additional features that make it more appealing to db management, what other advantages does it have when it comes to DB management?
Angius
Angius2y ago
Not requiring you to write SQL
surwren
surwren2y ago
Also, during runtime does EF+LINQ run any slower/faster than manual DB management+MySQLClient?
Angius
Angius2y ago
The difference is marginal to none
Monsieur Wholesome
laughs in horribly generated ef sql code
surwren
surwren2y ago
Database Providers - EF Core
Information about specific supported Entity Framework Core providers and about providers in general
surwren
surwren2y ago
So you are saying that these will automatically allow me to swap freely between MySQL, MsSQL, PostGres and MariaDB?
Angius
Angius2y ago
Yep Well, mostly. Sure, just swapping the driver will do the job most of the time, but if you're using for example array columns (Postgres) switching to MariaDB won't be easy since it doesn't support this feature
surwren
surwren2y ago
That's crazy I feel like a neanderthal for manually doing MySQL DB scripts