|
That's what I said: Stored procs. And why is that? Fewer round trips.
Actually, EF can also run on the server as part of REST, but most like to abuse it only from the client side.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
PIEBALDconsult wrote: Of course the client code runs on the client.
In C# the standard 'linq' API methodology to access the database relies on libraries (and versions) that are not necessarily correctly implemented to create the expected SQL.
I have seen expressions that I could see exactly how the SQL should look but instead resolved into things like the following. (No this was not a case of resolving a list incorrectly.)
1. The linq expression pulled the entire table then applied the where clauses in memory.
2. The linq expression, one expression, resolved to two different SQL calls which it then did the actual join in memory.
The only way to detect this happening is by profiling each linq statement.
|
|
|
|
|
You can use both EF and stored procedures together. Its not a either/or situation.
|
|
|
|
|
I have been using EF professionally for 10+ years now. Our websites and APIs run using EF.
I have no issues with EF and our team of 20+ devs are comfortable using it.
Microsoft pushes this technology because it works and it works well for its intended purposes. Its a tool, and like all tools, you either learn how to use it or you don't.
|
|
|
|
|
Admittedly, many of the ill feelings towards it go back to its initial release all the way back in 08 and release 2010 or so.
It wasn't great then & then we just left it alone. After that we began using the Repository pattern & it made things reasonable.
A few questions:
1. is there a good readable book that you would recommend that shows how to use EF for many database "structures" (master/detail, linking tables, etc)?
2. Do you find that it can be used well in cases where there is a master/detail type of relationships & you need to update data? Is it straight forward?
3. Have you found places where you can't get there from here type of behavior?
4. What are the most challenging data inserts & updates you've come across while using EF?
Thanks for your input.
|
|
|
|
|
EF is not SQL. It's a "table to entity" (or entity to table) mapper; and saves me a lot of work in that area.
If the only SQL one knows is "SELECT *", and doesn't ever use stored procs, then there will be issues.
I just make sure my "model" goes both ways: code first or data base first; and can use either one at any time to drive changes in the model in either direction.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
modified 28-Dec-22 23:29pm.
|
|
|
|
|
I bake "guaranteed future employment" cakes with inscrutable ingredients
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
sql and stored procedures are a bore to maintain... code is better....debugging etc.....i used third party orms and way better, always avoided stored proc ....
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
raddevus wrote: library Hibernate, it was actually more code to write than the equivalent behavior written in SQL, subjectively at least; the SQL was also easier to understand.
Of course though "subjective" is subjective.
But other than that, in my experience, those that are really excited about packaged database layers are those that either have no or little experience using database(s) directly. So of course for them doing no database work would seem like an advantage.
They also seem to ignore the potential design problems of ignoring the database itself as part of the architecture because when they start with the data sets are all very small.
|
|
|
|
|
That's actually a perfect summary of the challenge/problem.
I agree, because for example, EF works for those it works for and doesn't for those who it doesn't.
Most of the time EF works for those who don't know DB tech (sql, stored procs, etc) and doesn't "work" for those who would rather not have the layer between them and the DB.
6 one way, half a dozen the other.
There are the poor unfortunate souls who begin using EF to solve all their problems & don't understand it or DB tech and then believe it is EF's fault.
There really are advantages & disadvantages to both courses of action.
|
|
|
|
|
Just noting also that I have never used a database layer that did not require, over time, a hack either around it or through it to achieve the necessary goal of using the database correctly.
Although the scope of such work arounds should be limited over time they start to add complexity to the application because they are not fully integrated. This means, for example, that someone uses the work around because they did not understand how the API could be used to achieve the same thing. Or alternatively they failed to realize that the hack would be a better solution so they do things like multiple queries in the code and then doing in code correlations with the result.
|
|
|
|
|
These experiences that you talk about are exactly my experiences.
So interesting. Thanks for sharing these stories. I always feel like it is just my limited knowledge of the API but sometimes you just put so much time into learning it at some point you got to just do the thing. Then later you discover, oh, that's not what the API creator intended, but it is what the API creator led us into. 
|
|
|
|
|
All morning, my notification tray has been telling me I have no internet access. My browsers, fools that they are, think differently and are unwisely displaying the pages they cannot access and playing the videos they can't connect to.
This is the machine I am using to type this post, which I can't be doing as in theory I can't get to the CP website.
Clearly, you are also not reading this.
|
|
|
|
|
You must have a quantic computer that is and isn’t connected to internet at the same time
Mircea
|
|
|
|
|
Karin Krog, Bengt Hallberg: I ain't here[^]
On the more technical side: Could it possibly be that you have inadvertently defined an internet connection #2, and because it happened inadvertently, it is incomplete, and that is the one that the notification tray indication tries to report from? If the definition is incomplete, it makes sense that it doesn't work.
|
|
|
|
|
Don't worry Rich I didn't read your post and I didn't type this
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|
|
|
So, went out for a couple of hours so the Guv'nor could look at a sale and my world view is now changed after I got myself £155 worth of clothing for £58! I have warmed to the idea of shopping...
Got back, still a "No internet" warning. Refreshed and saw the new threads on this thread, followed a link on another web page and and then my connection vanished and I discovered my Wi-Fi connection had turned off in Settings.
Turned it back on and everything works again.
So was it a predictive message - "In three hours I'm going to kill your connection, Love Windows 11"?
|
|
|
|
|
Rich Leyshon wrote: "In three hours I'm going to kill your connection, Love Windows 11"
Windows 11. Giving you tomorrow's bugs - today!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
lol
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Where do you think you are?
"A little time, a little trouble, your better day"
Badfinger
modified 30-Dec-22 20:35pm.
|
|
|
|
|
Quote: This is tomorrow calling, wishing you were here ... 
|
|
|
|
|
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
is this a Schrodinger's cat type of questions?
You are both here and not? You exist but not?
Ahh, I have it...
you are management!! You are but aren't
A nebulous entity that lingers on the edge of perception ...
and toys with us but not ... thus the frustrations are there but not !
Its all clear not... but not
Cegarman
document code? If it's not intuitive, you're in the wrong field
|
|
|
|
|
If OP doesn't respond, maybe he has lost his hereing.
|
|
|
|