Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAr33ss Leon
4,621 PointsI am obligated to use Lazy loading?
I understood well to the instructor about eager and lazy loadings, for example in eager loads you need to add a .include() and in lazy loads add a virtual to any navgation property but... for example I do not always use first code to code my database using EF I always use sql server to model my databases and import via EF to my project but there is a problem. Imported databases from Entity frameworks are usually set to virtual which means they are in lazy loading mode. My question is, if they are set virtual by default am I obligated to use lazy loading? or did I misunderstood about the differences between them?
1 Answer
Steven Parker
231,269 PointsThere might be some some properties you can set to change loading behavior, but a really simple way to force immediate loading is to chain a ".ToList()
" onto your query.
Ar33ss Leon
4,621 PointsAr33ss Leon
4,621 Pointsgive me an example, I did not get you :( or can you be more specific please .
Steven Parker
231,269 PointsSteven Parker
231,269 PointsAr33ss Leon
4,621 PointsAr33ss Leon
4,621 Pointsgot you!