I have seen numerous examples of lazy loading - what's your choice?
Given a model class for example:
public class Person
{
private IList<Child> _children;
public IList<Child> Children
{
get {
if (_children == null)
LoadChildren();
return _children;
}
}
}
The Person class should not know anything about how it's children are loaded .... or should it? Surely it should control when properties are populated, or not?
Would you have a repository that couples a Person together with its children collection or would you use a different approach, such as using a lazyload class - even then, I don't want a lazyload class blurring in my model architecture.
How would you handle performance if first requesting a Person and then its Children (i.e. not lazy loading in this instance) or somehow lazy loading.
Does all this boil down to personal choice?