Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using AddOrUpdate from System.Data.Entity.Migrations
Message
De
08/04/2014 15:53:30
 
 
À
08/04/2014 15:46:15
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01598293
Message ID:
01598302
Vues:
27
I'm pretty sure I've created messes in my career. Hopefully I've cleaned up a lot more.

I once worked on an application that the business user mocked up in php. He was round tripping to the database ALOT. I moved the logic to a stored proc, which sped up the entire process from an hour+ to a couple of minutes.

One thing about EF that people need to think about is lazy loading. If you pull back a List of data then iterate through it, related data may be lazy loaded and a call is made to the server for EVERY row in the List. Look at using .Include in your LINQ statements when doing the original query.


>Follow-up on what I mentioned yesterday, about developers coming in to clean up bad approaches and being praised for far more than they really deserve
>
>Last summer I did a 2-day consulting trip for a place in New Jersey, where (among other things) the previous developer was using EF to invoke a stored procedure for a reporting process....invoking the proc up to 150,000 times, one for each row back in the EF layer. The process took up to five minutes. The developer actually told the client it would still be faster than passing up all the entity values in one shot. Turns out the developer didn't know how to do it, because he didn't know a bloody thing about SQL Server.
>
>I changed the code around to pass up a table type to the proc, and used a MERGE on the inside, and the process took about 15 seconds. (Then we had to spend an hour showing the business people that the end result values were still the same, because they figured anything that much faster must be missing steps.)
>
>So I got 2 days of billable time and 2 free dinners....all because the previous developer went "Full Retard" (borrowing from the line in the movie Tropic Thunder). Not an indictment of entity framework...the wrong person can mess up an application in any tool. Then again, thank goodness for idiots, they help my bottom line :)
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform