r/programming • u/Daniel_Born • Apr 28 '17
Entity Framework 6 Extensions You Might Be Unaware Of
http://codingsight.com/entity-framework-6-extensions-you-might-be-unaware-of/-6
u/vagif Apr 28 '17 edited Apr 28 '17
If you value your sanity, run away from Entity Framework like from a plague.
8
u/Eirenarch Apr 28 '17
Bullshit. I have 11 years of professional experience 7 using raw SQL (mostly stored procedures), 4 using EF. While I am not wildly in love with EF it has been a slight improvement.
1
u/DysFunctionalProgram Apr 28 '17
How it handles association tables (aka cross tables, many to many relationship tables) and query performance was the deal breaker for me.
I'll use it for really small systems that have really simple schemas to save a couple hours. But anything even the slightest bit complex still lives in stored procs and raw sql for me. Especially anything upsert heavy. I made the mistake of trying to use EF with an insert heavy system and it made what should have been 1 - 10 transactions over 200 transactions and take orders of magnitude longer.
6
u/Eirenarch Apr 28 '17
There is no problem to use EF for the normal queries and use SP and raw SQL (even attached to EF) for the complex queries. In fact I'd say that this is recommended. However in my experience most systems have a great number of simple queries and a small number of complex queries.
1
Apr 29 '17
[removed] — view removed comment
1
u/Eirenarch Apr 29 '17
Maybe. If I have to work on a project where I cannot meet the performance requirements with EF I would not use it.
1
Apr 29 '17
[removed] — view removed comment
2
u/Eirenarch Apr 29 '17
I don't know about Chain but this is certainly not true for Dapper. Just loading related entities (a single Include per related item in EF) makes EF code much faster and shorter to write. In micro ORMs you not only need to add the joins but need to manually build the relationship in C# code
1
Apr 29 '17
[removed] — view removed comment
1
u/Eirenarch Apr 29 '17
I can see how you can argue that views and denormalized objects will improve the architecture although I am skeptical. However I still don't see how that can lead to less code.
→ More replies (0)1
Apr 28 '17
Entity framework is fine for relatively simple database structures and dealing with one row at a time. Bog-standard CRUD stuff. Personally I still don't like it, but I can admit in that use case it works fine, and it does help to eliminate some boring and mindless boilerplate code you'd otherwise have to write.
Anything more complicated though? I'd rather just handle it myself because I guarantee entity framework will not perform properly the first time you try to implement it. You'll be fighting it and by the end you'll just wish you did it yourself.
1
Apr 29 '17
[removed] — view removed comment
1
u/Deif Apr 29 '17
Maybe you have the privilege of working only in intensive db environments. A lot of people don't really need/care for performance and it's often cheaper and easier to just whack in EF and be done with it.
1
Apr 29 '17
And all those introduce their own costs. If you truly care about performance down to the nanosecond you won't be using an ORM at all (and realistically you also won't be using .NET).
4
u/Sebazzz91 Apr 28 '17
Your comment has only value if you care to support your claims.
1
-6
u/skizmo Apr 28 '17
go spam somewhere else