November Happy Hour will be moved to Thursday December 5th.

TransactionScope and PurchaseOrder.AcceptChanges

Vote:
 

I'm currently adding fulfilment of PurchaseOrders inside EPiServer Commerce using an EPiServer Job (JobBase). This works fine but I'm running into a small problem with the TransactionScope.

The functional idea is as follows:

Start transaction
Update shipment status to "Shipped"
Accept shipment changes
Update order status to "Completed"
Accept order changes
Send order to fulfilment provider
Commit transaction

Seeing as I can't cancel the fulfilment, I want to make sure the order can be saved before fulfilling the order. The idea behind the transaction is that any failures during these steps result in a full rollback.

Now I've tried both Mediachase.Data.Provider.TransactionScope and SqlContext.Current.BeginTransaction, but both result in data being commited to the database without ever accepting the transaction (e.g. without calling Complete/Commit).

Am I doing something wrong? Is it even possible to wrap AcceptChanges in a transaction? If it is, which transaction class is required?

Regards, Jerremy

#60730
Aug 22, 2012 14:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.