You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="WorkflowTransactionService.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#region Using directives
|
||||
|
||||
using System;
|
||||
using System.Transactions;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace System.Workflow.Runtime.Hosting
|
||||
{
|
||||
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
|
||||
public abstract class WorkflowCommitWorkBatchService : WorkflowRuntimeService
|
||||
{
|
||||
public delegate void CommitWorkBatchCallback();
|
||||
|
||||
virtual internal protected void CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
|
||||
{
|
||||
Transaction tx = null;
|
||||
if (null == Transaction.Current)
|
||||
tx = new CommittableTransaction();
|
||||
else
|
||||
tx = Transaction.Current.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
|
||||
|
||||
try
|
||||
{
|
||||
using (TransactionScope ts = new TransactionScope(tx))
|
||||
{
|
||||
commitWorkBatchCallback();
|
||||
ts.Complete();
|
||||
}
|
||||
|
||||
CommittableTransaction committableTransaction = tx as CommittableTransaction;
|
||||
if (committableTransaction != null)
|
||||
committableTransaction.Commit();
|
||||
|
||||
DependentTransaction dependentTransaction = tx as DependentTransaction;
|
||||
if (dependentTransaction != null)
|
||||
dependentTransaction.Complete();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
tx.Rollback(e);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tx != null)
|
||||
{
|
||||
tx.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user