This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Does LightSpeed support savepoint type of concept? What I'm trying to do is grab number of rows from a table and start processing each row. Before processing each row I'd like to create a savepoint so if anything goes wrong it'll rollback to the saved savepoint and continue with next row. If it doesn't support that, can I control the database connection and transaction outside the LightSpeed? In anthoer word can we pass in the connection and transaction to the context object? |
|
|
You can do this to some extent using BeginEdit/EndEdit/CancelEdit. BeginEdit saves the current state of the entity. If you subsequently call CancelEdit then any changes since the last BeginEdit are rolled back. Note that this is on a per-entity basis, and that only one savepoint per entity is available. (If you do another BeginEdit, it "replaces" the previous one.) You can control database transactions by calling IUnitOfWork.BeginTransaction or (if the database provider supports it) by using a .NET TransactionScope. You can reuse an existing transaction by using the TransactionScope constructor that takes an existing Transaction. (I don't think you can enrol the unit of work in an existing IDbTransaction -- this will work only for System.Transactions transactions.) You can't control the connection -- the unit of work creates and manages this internally. |
|