Stack Exchange
Entity Framework linq to entity slow on code but fast in SQL Server Management Studio
The following EF query works slowly in code, but fast in SQL Server Management Studio. How can I rewrite this EF statement to improve execution time?
Context.OfferQuotations
          .Include(x => x.OfferRevision)
          .Include(x => x.OfferRevision.OfferParameters)
          .Include(x => x.OfferRevision.OfferParameters.Select(a => a.CostOfFundings.Select(i => i.OfferCostOfFunding.TermRange)))
          .Where(x => x.Id == quotationId);


Please show query which you run in Management Studio

I had this problem before, so I just turned on LazyLoading and ProxyCreating.
this.Context.Configuration.LazyLoadingEnabled = true;
this.Context.Configuration.ProxyCreationEnabled = true;

http://www.entityframeworktutorial.net/EntityFramework4.3/lazy-loading-with-dbcontext.aspx

Turn off lazyloading option of context. Follow this article
https://msdn.microsoft.com/en-us/library/jj574232(v=vs.113).aspx
then also try to convert your query into join, currently it is working in subquery way.
