I am using LLBLGen Pro 2.5 with self-servicing. If I want to add some rows into my tables within a transaction and then update the first row I added, do I have to add that first entity into the transaction object again?
Here is a fictional example of what I mean:
Dim objCustomer as New CustomerEntity() Dim trans as new Transaction(IsolationLevel.ReadCommitted, 'AddRecord') objCustomer.FirstName = 'John' objCustomer.LastName = 'Locke' objCustomer.DateCreated = DateTime.Now trans.Add(objCustomer) objCustomer.Save() Dim objOrder as New OrderEntity() objOrder.CustomerID = objCustomer.CustomerID objOrder.OrderDate = DateTime.Now trans.Add(objOrder) objOrder.Save() objCustomer.FirstOrderID = objOrder.OrderID trans.Add(objCustomer) 'DO I DO THIS?????? objCustomer.Save() trans.Commit()
Any advice would be greatly appreciated!
No, you don’t have to add it again. You can simply just do the save again. I use Adapter instead of Self Servicing, so I would have made sure to fetch my customer data upon saving, but I’m not sure if that is a requirement for self servicing or not.