irving at irvingevajoan

Background:
I have a web app (ABC), a state machine workflow (XYZ) and using Oracle DB (ORA). ABC is using ORA using iBatis.Net, which uses Microsoft's provider for Oracle (and not Oracle's ODP.Net). ABC also uses XYZ to store the states of its transaction. XYZ only contains states and events, there are no codes inside.

Problem:
In one page of ABC, there a process who do the following:
- update table 1
- insert table 2
- send event to workflow XYZ to move from state X1 to state X2
- update table 3
All these steps are within TransactionScope.

The problem is, if the transaction fails (let's say, update table 3 fails), the entire transaction is rolled back EXCEPT for the workflow. The state of the workflow is still X2, not rolled-back to X1. No exceptions or errors whatsoever occurs.

So, I'm wondering:
1. Do I forgot to add any service to the web.config I already have SQL persistence service.
2. MSDTC is running, and it already able to rollback to ORA. I wonder whether I need to do anything else to rollback workflow.
3. Do I need to create TransactionScope inside each event handler in each state Right now there is none, because I tought I need TransactionScope only if I'm updating some database from the workflow.
4. Or do I need to do something else which I don't know

Thanks alot for your help.


Re: Windows Workflow Foundation TransactionScope, State Machine, and Oracle DB

Mirricle

I have the same question



Re: Windows Workflow Foundation TransactionScope, State Machine, and Oracle DB

Khalid Aggag - MSFT

I assume there is only one workflow in your scenario, XYZ If so, currently we dont support flowing a transaction from outside the workflow into the workflow, i.e. the workflow will not participate in the external ambient transaction. Therefore when you rollback your transaction in the scenario you are describing the state of the workflow wont be affected.

Can you please clarify your scenario further Where and when are you persisting your workflow






Re: Windows Workflow Foundation TransactionScope, State Machine, and Oracle DB

irving at irvingevajoan

I'm still new with this, so please ask if you need more data.

I have an ASP.Net project, for approval process. For simplicity, let's say I'm creating a leave request approval system. I created 1 workflow (XYZ), with the following states:
- Submitted
- Approved
- Rejected
From "Submitted" state, only have 2 event handler, to receive "Approve" and "Reject" event. If "Approve" event is received, the state is changed to Approved. The same goes for "Reject", goes to Rejected. No codes is used, just plain state change. Not using transaction scope also, since the step is only to chnage state to another one.

Now, from the asp.net page, depending on whether the user click Approve or Reject, the page will send the appropriate event to the workflow. Afterwards, the page will do some updating to to Oracle, updating table A, table B, table C.

Now, all these steps are within TransactionScope in the asp.net page. If an exception happens, the page will rollback the transaction.

During our testing, if an exception happens, all our updates to table A, B, and C is rolled back. But the state change in the workflow is not rolled back.

I mentiond about persistence because I'm afraid it does have something to do with it. I'm using default persistence provider to SQL Server, with default setting in the web.config (persist on idle). I'm not using tracking right now.

I never read anywhere that the current WF does not support global transaction. If I know, I would not use it :-( Any workaround for my case




Re: Windows Workflow Foundation TransactionScope, State Machine, and Oracle DB

Khalid Aggag - MSFT

Ok now I understand your scenario more but unfortunately the limitation that I told about still does applies. The reason that we decided not to support external transaction flowing into the workflow for v1 is that it would be very difficult to keep the in memory copy of the workflow insync with the persisted copy incase the transaction was rolled back externally, the workflow wont have any means to know about that and adjust itself.

Given this, there is still a way to achieve what you want!! You can create a transition from 'approved/rejected' back to 'submitted' and when you detect that an exception has occured and the transaction has been rolled back, simply transition the workflow back to the submitted state.

I hope that helps.






Re: Windows Workflow Foundation TransactionScope, State Machine, and Oracle DB

irving at irvingevajoan

Is there an article or document that show this information about WF and external transaction I need to show them to my client so that they can understand the issue. A Microsoft issued doc is preferred.

I have tought about the same workaround as you mentioned. However, it requires modifications of a lot of xoml files plus modification to all related .cs files. I'm still discussing this with my team.

Thanks.