Normal Load methods will only load the current class type. LoadWithChildren will load the parents, and children of an object.
'Get the current instance of the helper
Dim
db As IDataHelper = DataHelper.SessionFactory()
'Create an Order with a Parent and Children
Dim
order As New Order()order.Buyer =
New Person() order.Buyer.FirstName = "John"order.Buyer.LastName =
"Smith"order.Buyer.DateCreated =
Date.Noworder.OrderDetails =
New List(Of OrderDetail)()
Dim
detail1 As New OrderDetail()detail1.Item =
New Product() detail1.Item.ProductName = "Wizard"detail1.Item.Cost = 29.98D
detail1.Quantity = 2
detail1.Order = order
order.OrderDetails.Add(detail1)
Dim
detail2 As New OrderDetail()detail2.Item =
New Product()detail2.Item.ProductName =
".NET Caching Library"detail2.Item.Cost = 199.95D
detail2.Quantity = 1
detail2.Order = order
order.OrderDetails.Add(detail2)
'Save parents and children
db.SaveWithChildren(order)
'Reload the entire tree
Dim
orderCopy As Order = db.LoadWithChildren(Of Order)(order.OrderId)