SqlWorkflowInstanceStore 类

定义

派生自持久性功能的抽象 InstanceStore 类,并提供实现以允许将实例状态信息保存到 SQL Server 2005 或 SQL Server 2008 数据库,或从该数据库中加载实例状态信息。Derives from the abstract InstanceStore class of the persistence functionality and provides implementation to allow saving instance state information to and loading instance state information from an SQL Server 2005 or SQL Server 2008 database.

public ref class SqlWorkflowInstanceStore sealed : System::Runtime::DurableInstancing::InstanceStore
public sealed class SqlWorkflowInstanceStore : System.Runtime.DurableInstancing.InstanceStore
type SqlWorkflowInstanceStore = class
    inherit InstanceStore
Public NotInheritable Class SqlWorkflowInstanceStore
Inherits InstanceStore
继承
SqlWorkflowInstanceStore

示例

下面的代码示例演示如何创建 SqlWorkflowInstanceStoreThe following code sample demonstrates creating a SqlWorkflowInstanceStore. 此示例来自持久性参与者示例。This example is from the Persistence Participants sample.

注解

SqlWorkflowInstanceStore 使用 NetDataContractSerializer 序列化复杂类型;要与此实例存储区一起保留的工作流中所使用的所有类型都必须可通过使用 NetDataContractSerializer 进行序列化。SqlWorkflowInstanceStore uses the NetDataContractSerializer to serialize complex types; all types used in workflows to be persisted with this instance store must be serializable using NetDataContractSerializer.

构造函数

SqlWorkflowInstanceStore()

初始化 SqlWorkflowInstanceStore 类的新实例。Initializes a new instance of the SqlWorkflowInstanceStore class.

SqlWorkflowInstanceStore(String)

使用 SqlWorkflowInstanceStore 参数初始化 connectionString 类的新实例。Initializes a new instance of the SqlWorkflowInstanceStore class by using the connectionString parameter.

属性

ConnectionString

获取或设置一个带参数的连接字符串,这些参数用于连接到基础持久性数据库。Gets or sets a connection string with parameters that are used to connect to an underlying persistence database.

DefaultInstanceOwner

获取或设置默认实例的所有者。Gets or sets the default instance owner.

(继承自 InstanceStore)
EnqueueRunCommands

获取或设置一个值,该值指示运行命令是否已排入队列。Gets or sets a value that indicates whether Run commands are enqueued. SQL 工作流实例存储在内部使用此属性,并且此属性不应在应用程序中使用。This property is used internally by the SQL Workflow Instance Store and it should not be used in your applications.

HostLockRenewalPeriod

指定时间段,宿主必须在该时间段内续订其在工作流服务实例上的锁。Specifies the time period within which the host renews its lock on a workflow service instance.

InstanceCompletionAction

指定要在工作流实例完成后采取的操作。Specifies the action to be taken after a workflow instance completes. 可能的值为“DeleteNothing”和“DeleteAll”。Possible values are "DeleteNothing" and "DeleteAll". 默认值为“DeleteAll”。The default value is "DeleteAll". 如果该属性设置为“DeleteNothing”,则持久性提供程序将在工作流实例完成后将所有实例数据和元数据保留在持久性数据库中。If the property is set to "DeleteNothing", the persistence provider keeps all the instance data and metadata in the persistence database after the workflow instance completes. 如果该属性设置为“DeleteAll”,则持久性提供程序将在工作流实例完成后删除所有实例数据和元数据。If the property is set to "DeleteAll", the persistence provider deletes all the instance data and metadata after the workflow instance completes.

InstanceEncodingOption

指定一个值,该值指示是否必须对实例数据进行压缩。Specifies a value that indicates whether the instance data must be compressed.

InstanceLockedExceptionAction

指定要在持久性提供程序捕获 InstanceLockedException 时采取的操作。Specifies the action to be taken when the persistence provider catches an InstanceLockedException.

MaxConnectionRetries

获取或设置最大 SQL 连接重试次数。Gets or sets the maximum number of SQL connection retries. 默认值为 4。The default value is 4.

RunnableInstancesDetectionPeriod

指定时间段,在该时间段后,SQL 工作流实例存储区将运行一个检测任务,来检测上一检测周期后持久性数据库中的任何可运行或可激活的工作流实例。Specifies the time period after which the SQL Workflow Instance Store runs a detection task to detect any runnable or activatable workflow instances in the persistence database after the previous detection cycle.

方法

BeginExecute(InstanceHandle, InstancePersistenceCommand, TimeSpan, AsyncCallback, Object)

异步执行永久性命令,如 LoadWorkflowCommandSaveWorkflowCommandAsynchronously executes persistence commands such as LoadWorkflowCommand and SaveWorkflowCommand.

(继承自 InstanceStore)
BeginTryCommand(InstancePersistenceContext, InstancePersistenceCommand, TimeSpan, AsyncCallback, Object)

永久性提供程序可实现此方法,这可确定是否可执行特定的永久性命令。A persistence provider implements this method, which determines whether a particular persistence command can be executed. 如果可以执行此命令,请异步执行此命令。If the command can be executed, executes the command asynchronously.

(继承自 InstanceStore)
BeginWaitForEvents(InstanceHandle, TimeSpan, AsyncCallback, Object)

开始一个异步操作,以侦听特定实例句柄的实例存储区引发的任何事件。Begins an asynchronous operation to listen for any events raised by the instance store for a specific instance handle.

(继承自 InstanceStore)
CreateInstanceHandle()

创建实例句柄。Creates an instance handle.

(继承自 InstanceStore)
CreateInstanceHandle(Guid)

创建实例句柄。Creates an instance handle. 如果设置了 DefaultInstanceOwner,此值将作为新句柄的实例所有者自动被绑定。If the DefaultInstanceOwner is set, the value is automatically bound as the new handle's instance owner. 作为参数传递的实例标识符会作为新句柄的实例自动进行绑定。The instance identifier passed as a parameter is automatically bound as the new handle's instance.

(继承自 InstanceStore)
CreateInstanceHandle(InstanceOwner)

创建实例句柄。Creates an instance handle. 如果作为参数传递的实例所有者不为 null,则此值会作为新的句柄实例所有者自动进行绑定。If the instance owner passed as a parameter is not null, the value is automatically bound as the new handle's instance owner. (否则,即使设置了 DefaultInstanceOwner,也不会绑定任何实例所有者。)(Otherwise, no instance owner is bound, even if DefaultInstanceOwner is set.)

(继承自 InstanceStore)
CreateInstanceHandle(InstanceOwner, Guid)

创建实例句柄。Creates an instance handle. 如果作为参数传递的实例所有者不为 null,则此值会作为新的句柄实例所有者自动进行绑定。If the instance owner passed as a parameter is not null, the value is automatically bound as the new handle's instance owner. (否则,即使设置了 DefaultInstanceOwner,也不会绑定任何实例所有者。)作为参数传递的实例标识符会作为新句柄的实例自动进行绑定。(Otherwise, no instance owner is bound, even if DefaultInstanceOwner is set.) The instance identifier passed as a parameter is automatically bound as the new handle's instance.

(继承自 InstanceStore)
EndExecute(IAsyncResult)

结束异步操作。Ends the asynchronous operation.

(继承自 InstanceStore)
EndTryCommand(IAsyncResult)

结束异步操作。Ends an asynchronous operation.

(继承自 InstanceStore)
EndWaitForEvents(IAsyncResult)

结束由 BeginWaitForEvents(InstanceHandle, TimeSpan, AsyncCallback, Object) 方法启动的异步操作。Ends the asynchronous operation initiated by the BeginWaitForEvents(InstanceHandle, TimeSpan, AsyncCallback, Object) method.

(继承自 InstanceStore)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Execute(InstanceHandle, InstancePersistenceCommand, TimeSpan)

异步执行永久性命令。Executes a persistence command synchronously. 永久性命令的示例:LoadWorkflowCommandSaveWorkflowCommandExamples of persistence commands are: LoadWorkflowCommand and SaveWorkflowCommand.

(继承自 InstanceStore)
GetEvents(InstanceOwner)

获取已绑定到 InstanceOwner 对象的所有已终止事件。Gets all the signaled events bound to an InstanceOwner object.

(继承自 InstanceStore)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetInstanceOwners()

获取已绑定到有效实例句柄或没有进行垃圾回收的每个 InstanceOwner 对象。Gets each InstanceOwner object that is bound to a valid instance handle or has not been garbage collected.

(继承自 InstanceStore)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnFreeInstanceHandle(InstanceHandle, Object)

在释放实例句柄时调用。Invoked when an instance handle is freed.

(继承自 InstanceStore)
OnNewInstanceHandle(InstanceHandle)

在创建新实例句柄时调用。Invoked when a new instance handle is created.

(继承自 InstanceStore)
Promote(String, IEnumerable<XName>, IEnumerable<XName>)

将指定的属性与工作流实例相关联,以便能够基于这些属性的特定值查询实例。Associates the specified properties with a workflow instance so that you can query for instances based on specific values for these properties. 可在外部查询中使用的这些属性可以是简单类型(例如:Int64、字符串等)或串行化的二进制类型(字节 [])。These properties that can be used in external queries can be of simple types (for example: Int64, String, and so on) or of a serialized binary type (byte[]). 二进制属性通常用于存储跟踪数据。Binary properties are typically used to store tracking data.

ResetEvent(InstancePersistenceEvent, InstanceOwner)

重置已终止事件,并从由实例所有者维护的已终止事件的列表中移除该事件。Resets the signaled event and removes the event from the signaled events list maintained by the instance owner.

(继承自 InstanceStore)
SignalEvent(InstancePersistenceEvent, InstanceOwner)

实例存储区可调用此方法来使事件终止。An instance store invokes this method to signal an event. 为此永久性事件订阅的工作流主机可接收这些信号,并可采取适当的措施。A workflow host that subscribes for this persistence event receives it and takes an appropriate action.

(继承自 InstanceStore)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
TryCommand(InstancePersistenceContext, InstancePersistenceCommand, TimeSpan)

永久性提供程序可实现此方法,这可确定是否可执行特定的永久性命令和是否可异步执行此命令。A persistence provider implements this method, which determines whether a particular persistence command can be executed and if the command can be executed executes it asynchronously.

(继承自 InstanceStore)
WaitForEvents(InstanceHandle, TimeSpan)

工作流主机通常会调用此方法来等待事件终止。A workflow host typically invokes this method to wait for an event to be signaled.

(继承自 InstanceStore)

适用于