Welcome to MSDN Blogs Sign in | Join | Help

.NET 3.5 Workflow transaktiokäsittely

Tänään Visual Studio 2008 seminaarissa Katajanokalla Marina Congress Centerissä ja aikaisemmin muutamissa asiakastapaamisissa on noussut kysymys tukeeko .NET 3.5:n Workflow jo ns. ambient transaktioon liittymistä. Valitettavasti vastaus on tässä vaiheessa ei. Asiaa on käsitelty esim. MSDN-foorumien keskustelusäikeessä: Executing workflow under distributed transaction. Osittaisiksi kiertokeinoiksi tarjotaan:

"You can interact with transaction in WF in three ways:

  • TransactionScopeActivity to coordinate work within and stemming from a workflow.
  • A work item or custom service that implements IPendingWork will receive notification when a persistence commit occurs.  For example when enqueuing a message to an instance you can provide an object that implements IPendingWork.  When the next persistence point occurs that IPendingWork will get a call to Commit with the persistence transaction.
  • You can flow a transaction into a workflow when calling WorkflowInstance.Unload.  This allows the following pattern:
    1. Create a System.Transaction.TransactionScope in your host code
    2. Do some transaction aware work (for example dequeue a row from a database work queue).
    3. Deliver a message to a workflow.
    4. Call WorkflowInstance.Suspend
    5. Call WorkflowInstance.Unload
    6. Commit the TransactionScope
    7. Call WorkflowInstance.Resume

In this example the persistence point that occurs as part of the Unload in [5] will be transactionally consistent with the work done in [2]."

"...you can't actually flow in a transaction in such a way that your activity will execute under it.  In the third case the transaction only flows in for the Unload call and coordinates workbatch commit data (such as persistence or any custom service that implements IPendingWork)."

Published Tuesday, November 27, 2007 10:05 AM by PasiM
Filed under: ,

Comments

No Comments
New Comments to this post are disabled
 
Page view tracker