When working with Linq to SQL you can use DataLoadOptions to specify which "child" objects to load. Is there a similar technique with BLToolkit?
It's nice that with BLT I can create the BO directly, like:
from p in db.Parent
select new Parent
{
ParentId = p.ParentId,
Child = p.Child
};
however going this route, while the entire Child object is created, I would need to specify every field in Parent (i.e. ParentId, ParentName, ParentDob, etc.)
Thanks.
Not exactly like LoadWith, but in my opinion the approach below is even better / cleaner (less magic). In your BO make a static function that would look like this:
Now you'd need to write your LINQ query like this:
So rather than "select p" or "select new Parent()" we let the static function return "p" but also assign the Child object to "parent.Child" before returning. As long as your associations are setup properly (BLToolkit.Mapping.Association) p.Child would tell BLT to join to the Child table as well. You could go even further, i.e. p.Child.Friends.etc.