Delete an object and all associated children in the database.
'Get the current instance of the helper
Dim db As IDataHelper = DataHelper.SessionFactory()
'Build a record to save to the database
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 it
db.SaveWithChildren(order)
'Delete it
db.DeleteWithChildren(order)