I would like to preload my catalog in my web application. I’m using EF4 and would like to prefetch all my catalog data. Is there a simple way to do it with EF4 ?
DB structure :
Catalog -> Category -> [Category ->] product -> options
How can I preload all objects on application start ?
Thanks
You can simply call:
I assume that
Cataloghas navigation propertyCategories,Categoryhas navigation propertyProductsandProducthas navigation propertyOptions. This will probably create enormous result set.Pre-loading such big amount of data usually doesn’t make any sense. I would say don’t do it and load data on demand when you need them. Pre-loading make sense for data which do not change and present almost on every page you show to clients.