none
EF 4.0 is loading all child collection. RRS feed

  • Question

  • I dont know why, when I query for items using EF 4.0 all the children are loading by default. I never specified this, why is this happening?
    Garejoor.com
    Tuesday, August 30, 2011 1:09 AM

Answers

  • Hi,

    What you are seeing is more likely the "lazy loading" feature that is when you start to iterate a collection, a query is issued to the server to load the collection. It includes inspecting collections with the debugger which confuses new comers to EF as it give them the imprssion that EF loads the whole db when it is actually load on demand. See http://msdn.microsoft.com/en-us/library/bb896272.aspx and the Lazy Loading section.

     


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
    • Marked as answer by Garejoor Tuesday, September 6, 2011 4:25 PM
    Tuesday, August 30, 2011 8:06 AM

All replies

  •  

    Can you post your code please. Thank you.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Tuesday, August 30, 2011 3:35 AM
  • Hi,

    What you are seeing is more likely the "lazy loading" feature that is when you start to iterate a collection, a query is issued to the server to load the collection. It includes inspecting collections with the debugger which confuses new comers to EF as it give them the imprssion that EF loads the whole db when it is actually load on demand. See http://msdn.microsoft.com/en-us/library/bb896272.aspx and the Lazy Loading section.

     


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
    • Marked as answer by Garejoor Tuesday, September 6, 2011 4:25 PM
    Tuesday, August 30, 2011 8:06 AM