Dim instance As IDataHelper Dim entity As T Dim value As Integer value = instance.DeleteWithChildren(Of T)(entity)
Parameters
- entity
- The object to delete
Type Parameters
- T
- Generic class type
Return Value
The number of records deleted
Dim instance As IDataHelper Dim entity As T Dim value As Integer value = instance.DeleteWithChildren(Of T)(entity)
//Get the current thread static safe instance of the helper IDataHelper db = DataHelper.SessionFactory(); //Specify User Name and License Key from the receipt, leave blank for trial mode //db.UserName = "John Smith 1234"; //db.LicenseKey = "asdfl219=="; //Open the database connection db.OpenConnection(); //Build a record to save to the database Order order = new Order(); order.Buyer = new Person(); order.Buyer.FirstName = "John"; order.Buyer.LastName = "Smith"; order.Buyer.DateCreated = DateTime.Now; order.OrderDetails = new List<OrderDetail>(); OrderDetail detail1 = new OrderDetail(); detail1.Item = new Product(); detail1.Item.ProductName = "Wizard"; detail1.Item.Cost = 29.98M; detail1.Quantity = 2; detail1.Order = order; order.OrderDetails.Add(detail1); OrderDetail detail2 = new OrderDetail(); detail2.Item = new Product(); detail2.Item.ProductName = ".NET Caching Library"; detail2.Item.Cost = 199.95M; detail2.Quantity = 1; detail2.Order = order; order.OrderDetails.Add(detail2); //Save it db.SaveWithChildren(order); //Delete it db.DeleteWithChildren(order); //Close the connection db.CloseConnection();
'Get the current thread static safe instance of the helper Dim db As IDataHelper = DataHelper.SessionFactory() 'Specify User Name and License Key from the receipt, leave blank for trial mode 'db.UserName = "John Smith 1234" 'db.LicenseKey = "asdfl219==" 'Open the database connection db.OpenConnection() '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.Now order.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) 'Close the connection db.CloseConnection()
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2