I have a framework that loads a lot of child collections from a non-database source. I recently got a use case where the resource is on network drives, and it is taking forever to get the collections loaded. I still need to support the eager loading scenario, but I now need to add lazy loading.
I had the solution to this bookmarked, but now I can’t find that link. Google hasn’t returned any usable links so far. The first reaction is to just add a Boolean parameter to the constructor. I know that this is a bad ‘code smell’ and I remember the answer being something different.
Can anybody point me to a resource on how to solve this problem?
MORE INFO:
The collections are vertical, not horizontal. That’s why loading in the background will not work in this specific case. That data is stored in a hierarchical structure similar to folders. I’ve seen some structures go up to 10 levels deep.
The solution turned out to be simpler than I thought. I just mixed the modes at different levels. By this I mean that I used eager loading at the topmost horizontal collections, and converted anything else below this to lazy loading.
It works really well. Now the UI, that uses this framework, is very responsive.