I 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?
Steven Parker172,328 Points
There 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.