Click here to Skip to main content
15,885,309 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Question for DB admins, DB architects, etc. Pin
Phil Boyd28-Apr-21 1:22
Phil Boyd28-Apr-21 1:22 
GeneralRe: Question for DB admins, DB architects, etc. Pin
Jan Holst Jensen229-Apr-21 11:43
Jan Holst Jensen229-Apr-21 11:43 
GeneralRe: Question for DB admins, DB architects, etc. Pin
LucianPopescu27-Apr-21 21:42
LucianPopescu27-Apr-21 21:42 
GeneralRe: Question for DB admins, DB architects, etc. Pin
KateAshman27-Apr-21 23:23
KateAshman27-Apr-21 23:23 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Sander Rossel27-Apr-21 22:47
professionalSander Rossel27-Apr-21 22:47 
GeneralRe: Question for DB admins, DB architects, etc. Pin
Phil Boyd28-Apr-21 1:26
Phil Boyd28-Apr-21 1:26 
GeneralRe: Question for DB admins, DB architects, etc. Pin
jochance28-Apr-21 5:24
jochance28-Apr-21 5:24 
AnswerRe: Question for DB admins, DB architects, etc. PinPopular
Carl_Sharman27-Apr-21 22:55
Carl_Sharman27-Apr-21 22:55 
I've been using Entity Framework for about 10 years. Before that, I had 20 years experience in hand-coded SQL queries through stored procedures and views. So, I've used both approaches extensively. This is what I've found.

Against:
1) It occasionally produces poor-performing queries, especially when they are big
2) It consistently produces queries that are very hard to understand

For:
1) It saves a lot of time in the maintenance of stored procedures and views (or the ugliness of in-line SQL, if that's your thing)
2) You get compile-time checking. If I refactor my schema, my code breaks until I fix the problems.

Does it matter in my job?

Yes.

Does it positively or negatively affect database design or performance?

No affect on DB design - I design my database independently then hook EF up to that. It does have an affect on performance though in some cases. Generally, it's fine for simple CRUD operations, but where you have complex joins and grouping it can (but not necessarily will) produce slow queries. I'm generally pleasantly surprised by the perfomance. It produces crazy-looking queries with lots of sub-queries, but they seem to perform OK. I guess the EF designers know what SQL can handle.

My approach is to use EF where EF is fine, then drop into views/stored procs where necessary. The difficulty here is with inexperienced team members who may never get the opportunity to learn to hand-code SQL, so will just rely on EF when they shouldn't. Also, some developers just don't like the idea of mixing strategries and would prefer all or nothing.

Does its use ever cause you any headaches or make your job any easier?

Yes and yes!

The LINQ syntax can get very complex. Sometimes it's just quicker to write the SQL yourself. Occasionally queries need to be written in SQL for performance reasons. It all depends what you are doing really. If you are doing complex transactions on high volumes of data, then EF may not be the best choice for that.

The time saver isn't so much not having to write T-SQL, but on the admin overhead of having to write views/sprocs seperately from the rest of my code. The compile-time checking is the real benefit for me though. In the past, a common problem I had was production bugs due to an obscure view or sproc that wasn't updated after a schema change. Now, I have a limited number of views and sprocs to check, and the rest is caught by the compiler. This is the single biggest advantage for me. It's reduced production bugs and gives me a sense of safety to re-factor.

Cheers,
Carl
AnswerRe: Question for DB admins, DB architects, etc. Pin
Snorri Kristjansson27-Apr-21 23:04
professionalSnorri Kristjansson27-Apr-21 23:04 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Slacker00728-Apr-21 0:17
professionalSlacker00728-Apr-21 0:17 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Jörgen Andersson28-Apr-21 1:31
professionalJörgen Andersson28-Apr-21 1:31 
AnswerRe: Question for DB admins, DB architects, etc. Pin
maze328-Apr-21 6:28
professionalmaze328-Apr-21 6:28 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Gerry Schmitz28-Apr-21 8:00
mveGerry Schmitz28-Apr-21 8:00 
GeneralRe: Question for DB admins, DB architects, etc. Pin
MSBassSinger28-Apr-21 8:11
professionalMSBassSinger28-Apr-21 8:11 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Matt McGuire28-Apr-21 12:51
professionalMatt McGuire28-Apr-21 12:51 
AnswerRe: Question for DB admins, DB architects, etc. Pin
#realJSOP28-Apr-21 22:36
mve#realJSOP28-Apr-21 22:36 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Luca Leonardo Scorcia30-Apr-21 13:21
professionalLuca Leonardo Scorcia30-Apr-21 13:21 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Tomasz Jureczko2-May-21 7:14
Tomasz Jureczko2-May-21 7:14 
GeneralUnknown unknowns Pin
honey the codewitch27-Apr-21 11:05
mvahoney the codewitch27-Apr-21 11:05 
GeneralRe: Unknown unknowns Pin
BillWoodruff27-Apr-21 11:40
professionalBillWoodruff27-Apr-21 11:40 
GeneralRe: Unknown unknowns Pin
honey the codewitch27-Apr-21 11:42
mvahoney the codewitch27-Apr-21 11:42 
GeneralRe: Unknown unknowns Pin
BillWoodruff27-Apr-21 12:07
professionalBillWoodruff27-Apr-21 12:07 
GeneralRe: Unknown unknowns PinPopular
honey the codewitch27-Apr-21 12:12
mvahoney the codewitch27-Apr-21 12:12 
GeneralRe: Unknown unknowns Pin
Eddy Vluggen27-Apr-21 12:05
professionalEddy Vluggen27-Apr-21 12:05 
GeneralRe: Unknown unknowns Pin
honey the codewitch27-Apr-21 12:14
mvahoney the codewitch27-Apr-21 12:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.