Akhil Khare
Can you disable lazy/deferred loading?
By Akhil Khare in LINQ on Aug 06 2014
  • Arnab Chatterjee
    Jun, 2018 7

    Lazy loading comes by default in Linq, you can not turn it off. You can although do an explicit loading by doing a ToList() or ToArray(), which essentially iterates over the returned object so that a list or array is created. Or you can also do a foreach just after the query so that the query is executed. Both cases are actually making the query execute immediately.

    • 0
  • Munesh Sharma
    Jun, 2015 16

    http://www.planetofcoders.com/can-you-disable-lazydeferred-loading/

    • 0
  • Akhil Khare
    Aug, 2014 6

    Yes, you can turn off the lazy loading feature by setting LazyLoadingEnabled property of the ContextOptions on context to false. Now you can fetch the related objects with the parent object in one query itself.context.ContextOptions.LazyLoadingEnabled = false;

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS