WorkflowCommitWorkBatchService 类

定义

注意

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

允许使用自定义逻辑提交工作批次。

public ref class WorkflowCommitWorkBatchService abstract : System::Workflow::Runtime::Hosting::WorkflowRuntimeService
public abstract class WorkflowCommitWorkBatchService : System.Workflow.Runtime.Hosting.WorkflowRuntimeService
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class WorkflowCommitWorkBatchService : System.Workflow.Runtime.Hosting.WorkflowRuntimeService
type WorkflowCommitWorkBatchService = class
    inherit WorkflowRuntimeService
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type WorkflowCommitWorkBatchService = class
    inherit WorkflowRuntimeService
Public MustInherit Class WorkflowCommitWorkBatchService
Inherits WorkflowRuntimeService
继承
WorkflowCommitWorkBatchService
派生
属性

示例

下面的示例演示一个从 WorkflowCommitWorkBatchService 继承的类。

//Implementation of the abstract WorkflowCommitWorkBatchService class
class DefaultCommitWorkBatchService : WorkflowCommitWorkBatchService
{
    protected override void CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
    {
        // Call base implementation
        try
        {
            base.CommitWorkBatch(commitWorkBatchCallback);
        }
        catch (Exception e)
        {
            // Report work batch commit failures
            Console.WriteLine("Work batch failed: " + e.Message.ToString());
            throw;
        }
    }
}
'Implementation of the abstract WorkflowCommitWorkBatchService class
Class DefaultCommitWorkBatchService
    Inherits WorkflowCommitWorkBatchService

    Protected Overrides Sub CommitWorkBatch(ByVal commitWorkBatchCallback As CommitWorkBatchCallback)
        ' Call base implementation
        Try
            MyBase.CommitWorkBatch(commitWorkBatchCallback)
        Catch e As Exception
            ' Report work batch commit failures
            Console.WriteLine("Work batch failed: " + e.Message.ToString())
            Throw
        End Try
    End Sub
End Class

注解

注意

本材料讨论的类型和命名空间已废弃不用。 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型

当提交工作批次时,运行时将对 WorkflowCommitWorkBatchService 进行调用并为其提供委托,调用该委托可以对工作批次执行实际提交。 运行时仍承担提交工作批次的主要责任,但允许 WorkflowCommitWorkBatchService 将自身插入到进程中,以便根据提交进程进行自定义。

此进程允许自定义错误处理逻辑。 如果 WorkflowCommitWorkBatchService 拥有事务(当 Transaction.Current 属性返回 null 时会出现这种情况,因此必须创建新的环境事务),则允许多次调用委托,为每次调用创建一个新的事务。 例如,一个最常见的情况就是处理间歇性网络问题或 SQL 群集故障转移。 如果对 WorkflowCommitWorkBatchService.CommitWorkBatchCallback 的调用引发了异常,则 WorkflowCommitWorkBatchService 可以捕获此异常、启动新的事务并再次调用委托。 这为工作流实例执行提供了一定的弹性,否则将导致工作流终止。

构造函数

WorkflowCommitWorkBatchService()
已过时.

在派生类中实现时,初始化 WorkflowCommitWorkBatchService 类的新实例。

属性

Runtime
已过时.

获取此服务的 WorkflowRuntime

(继承自 WorkflowRuntimeService)
State
已过时.

获取 WorkflowRuntimeService 的状态。

(继承自 WorkflowRuntimeService)

方法

CommitWorkBatch(WorkflowCommitWorkBatchService+CommitWorkBatchCallback)
已过时.

调用该方法可提交工作批次。

Equals(Object)
已过时.

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()
已过时.

作为默认哈希函数。

(继承自 Object)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
OnStarted()
已过时.

在派生类中重写时,表示将在工作流运行时引擎引发 Started 事件时调用的方法。

(继承自 WorkflowRuntimeService)
OnStopped()
已过时.

在派生类中重写时,表示将在工作流运行时引擎引发 Stopped 事件时调用的方法。

(继承自 WorkflowRuntimeService)
RaiseServicesExceptionNotHandledEvent(Exception, Guid)
已过时.

引发 ServicesExceptionNotHandled 事件。

(继承自 WorkflowRuntimeService)
Start()
已过时.

在派生类中重写时,启动服务并将 State 更改为 Starting

(继承自 WorkflowRuntimeService)
Stop()
已过时.

在派生类中重写时,停止服务并将 State 更改为 Stopping

(继承自 WorkflowRuntimeService)
ToString()
已过时.

返回表示当前对象的字符串。

(继承自 Object)

适用于