Transactions


Author
Message
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
My question is this, when exactly do I know a transactional save has been successful?



The code below is from the documentation for illustration purposes.



Lets say that the BO me.customers had records added that were imported from an XML file. Once I know that information is safely saved off to my SQL server I want to dispose of/archive the XML source.



Where in the code below would you actually be 100% sure the values were saved successfully enough to delete the file?



Thank you.



Public Sub SaveAllOnTransaction()

'-- Add a try around the transaction processing

' This enables the process to call TransactionRollback()

' if anything bad happens during the transaction process.

Try

'-- Start the transaction

BusinessLayer.TransactionBegin(Data.IsolationLevel.ReadCommitted)



'-- Save the business objects on the transaction

Me.Customers.Save(True)

Me.Orders.Save(True)

Me.OrderItems.Save(True)



'-- When business objects are saved on the transaction, the

' pending changes to their internal DataTables are NOT saved

' until TransactionEnd() is called...

'-- Call transaction end to commit the transaction queries and

' accept the pending changes on all of the business objects

' that participated in the transaction.

BusinessLayer.TransactionEnd()



Catch ex As Exception

'-- If an exception occurs during the saving of the records, then

' abort the transaction.

BusinessLayer.TransactionRollback()

End Try

End Sub


Keith Chisarik
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search