Click here to Skip to main content
15,501,747 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 2:22
MemberPhil Boyd28-Apr-21 2:22 
GeneralRe: Question for DB admins, DB architects, etc. Pin
Jan Holst Jensen229-Apr-21 12:43
MemberJan Holst Jensen229-Apr-21 12:43 
GeneralRe: Question for DB admins, DB architects, etc. Pin
LucianPopescu27-Apr-21 22:42
MemberLucianPopescu27-Apr-21 22:42 
GeneralRe: Question for DB admins, DB architects, etc. Pin
KateAshman28-Apr-21 0:23
MemberKateAshman28-Apr-21 0:23 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Sander Rossel27-Apr-21 23:47
professionalSander Rossel27-Apr-21 23:47 
GeneralRe: Question for DB admins, DB architects, etc. Pin
Phil Boyd28-Apr-21 2:26
MemberPhil Boyd28-Apr-21 2:26 
GeneralRe: Question for DB admins, DB architects, etc. Pin
jochance28-Apr-21 6:24
Memberjochance28-Apr-21 6:24 
AnswerRe: Question for DB admins, DB architects, etc. PinPopular
Carl_Sharman27-Apr-21 23:55
MemberCarl_Sharman27-Apr-21 23: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 Kristjansson28-Apr-21 0:04
professionalSnorri Kristjansson28-Apr-21 0:04 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Slacker00728-Apr-21 1:17
professionalSlacker00728-Apr-21 1:17 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Jörgen Andersson28-Apr-21 2:31
professionalJörgen Andersson28-Apr-21 2:31 
AnswerRe: Question for DB admins, DB architects, etc. Pin
maze328-Apr-21 7:28
professionalmaze328-Apr-21 7:28 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Gerry Schmitz28-Apr-21 9:00
mveGerry Schmitz28-Apr-21 9:00 
GeneralRe: Question for DB admins, DB architects, etc. Pin
MSBassSinger28-Apr-21 9:11
professionalMSBassSinger28-Apr-21 9:11 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Matt McGuire28-Apr-21 13:51
professionalMatt McGuire28-Apr-21 13:51 
AnswerRe: Question for DB admins, DB architects, etc. Pin
#realJSOP28-Apr-21 23:36
mva#realJSOP28-Apr-21 23:36 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Luca Leonardo Scorcia30-Apr-21 14:21
professionalLuca Leonardo Scorcia30-Apr-21 14:21 
AnswerRe: Question for DB admins, DB architects, etc. Pin
Tomasz Jureczko2-May-21 8:14
MemberTomasz Jureczko2-May-21 8:14 
GeneralUnknown unknowns Pin
honey the codewitch27-Apr-21 12:05
mvahoney the codewitch27-Apr-21 12:05 
GeneralRe: Unknown unknowns Pin
BillWoodruff27-Apr-21 12:40
mveBillWoodruff27-Apr-21 12:40 
GeneralRe: Unknown unknowns Pin
honey the codewitch27-Apr-21 12:42
mvahoney the codewitch27-Apr-21 12:42 
GeneralRe: Unknown unknowns Pin
BillWoodruff27-Apr-21 13:07
mveBillWoodruff27-Apr-21 13:07 
GeneralRe: Unknown unknowns Pin
honey the codewitch27-Apr-21 13:12
mvahoney the codewitch27-Apr-21 13:12 
GeneralRe: Unknown unknowns Pin
Eddy Vluggen27-Apr-21 13:05
professionalEddy Vluggen27-Apr-21 13:05 
GeneralRe: Unknown unknowns Pin
honey the codewitch27-Apr-21 13:14
mvahoney the codewitch27-Apr-21 13: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.


Straw Poll

How would you describe your current job?
Fighting dragons everyday or clicking the same boxes on the same forms, day after day?
  Results   276 votes