I am using Singleton pattern for my application, I have used ADO.NET Entity framework as my Data Access Layer, after login to my application, it's taking 3 to 5 minutes to load the dashboard.

Is there a way to reduce the time? Or I have to look for some other methods instead of Entity framework?

  • 3-5 minutes is really long time. You should try using something like EFProf to check if there is something wrong.
    – Euphoric
    Commented Dec 19, 2013 at 10:21

2 Answers 2


Entity Framework does have a warm up time but it's a couple of seconds. 3-5 minutes suggests something seriously wrong with your queries.

You should use something like Linqpad to see what SQL your LINQ to Entities is generating and work at optimizing it. Assuming of course you have done some troubleshooting and worked out that the DAL is your problem area.

If you are happy with the queries another area to look at if the data changes a lot is your indexes. Check your SQL Statistics are up to date and the fields being used for filtering are indexed.

  • I emphasise the comment about checking your indices. The last time I had an issue like the one you describe, a single foreign key had not been declared. EF does not take that long to initialise.
    – Mr Cochese
    Commented Dec 19, 2013 at 11:50

Feel free to downvote since ORMs seem popular these days, but...

WHY are you using Entity Framework? Is there a possibility that the backend database might change? Are you nervous about writing SQL stored procedures to deliver your data?

Or possibly does it seem that writing a lot of transforms from DbDataReader rows to your objects might be a lot of work?

I'm asking because I've had the misfortune to work on a couple of projects where the developer went for Entity Framework and specifically, was ordered by management to rip it out and go to decent SQL Stored Procs (which can be optimized and have an execution plan) and datareaders PURELY because of the godawful performance you have also experienced.

Where a dashboard requires (according to SQL Profiler) in excess of 48,500 database calls to return before it ever loads, there is an issue. I never see this addressed, so I'm hoping some kind soul will enlighten me.

  • 4
    Just want to point out that if a developer writes EF code that makes 48,500 database calls to load a page, the fault is with the developer, not EF.
    – Eric King
    Commented Dec 27, 2013 at 20:12
  • Is it? When the domain model is a huge tangle and EF is Lazy Loading navigation properties everywhere via single roundtips to the database? Commented Dec 27, 2013 at 20:16
  • 1
    Yeah, I feel pretty safe to say, yes, it's the developer's fault. I can think of no reason, regardless of the domain model, for that many db calls. Somebody doesn't know how to use their tools.
    – Eric King
    Commented Dec 27, 2013 at 20:23
  • In this case, I accept that the developer was probably responsible. But he used EF to deal with a recursive data structure so... inevitable. I used ADO.NET and SQL2012's Hierarchy data type. Commented Dec 27, 2013 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.