"Old Style" lazy loadingOld forum URL: forums.lhotka.net/forums/t/8351.aspx
whelzer posted on Thursday, January 14, 2010Quick question on old style lazy loading a child collections, the article by Rocky dated 4/11/2003,
gives the following:
Details = Details.NewDetails()
If mDetails Is
mDetails = Details.GetDetails(Me.ID)End If
My question related to the GetDetails method on the Details child object, should this operation be in a DP_Fetch? By definition child objects don't have DP_ methods so I'm a bit confused.
Any pointers much appreciated.
Sooner we away from version 3.0.4 the better!
Marjon1 replied on Thursday, January 14, 2010Yes, the GetDetails should call a normal DP_Fetch, you just have to remember to still call MarkAsChild() and you are good to go.
The only other thing to highlight, is that the above code would never actually load the list because mDetails always has a value. The Details.NewDetails() call should be in the DP_Create if you are using one.
I am about to have to change about 2 dozen children lists from being loaded as part of the parent to being lazy-loaded, I wish I was on 3.6 or above!
JoeFallon1 replied on Thursday, January 14, 2010
Or just initialize the variable like this:
Private mDetails As Details = Nothing
Marjon1 replied on Thursday, January 14, 2010That's true, it just depends on if there is ever a real scenario to have a new list of details vs always fetching a list and it returning no items within.
whelzer replied on Friday, January 15, 2010Thanks for the responses. Works a treat..
Copyright (c) Marimer LLC