Share via


SqlTrackingQuery.TryGetWorkflow(Guid, SqlTrackingWorkflowInstance) 方法

定义

尝试为指定工作流实例获取查询数据。

public:
 bool TryGetWorkflow(Guid workflowInstanceId, [Runtime::InteropServices::Out] System::Workflow::Runtime::Tracking::SqlTrackingWorkflowInstance ^ % workflowInstance);
public bool TryGetWorkflow (Guid workflowInstanceId, out System.Workflow.Runtime.Tracking.SqlTrackingWorkflowInstance workflowInstance);
member this.TryGetWorkflow : Guid * SqlTrackingWorkflowInstance -> bool
Public Function TryGetWorkflow (workflowInstanceId As Guid, ByRef workflowInstance As SqlTrackingWorkflowInstance) As Boolean

参数

workflowInstanceId
Guid

为其请求跟踪数据的工作流实例的 Guid

workflowInstance
SqlTrackingWorkflowInstance

如果此方法返回 true,将包含一个 SqlTrackingWorkflowInstance,它提供对与工作流实例关联的跟踪数据的访问。 该参数未经初始化即被传递。

返回

如果跟踪数据可用于请求的工作流实例,则为 true;否则为 false

例外

ConnectionString 为空引用(在 Visual Basic 中为 Nothing)。

示例

下面的代码示例演示如何使用 TryGetWorkflow 方法来检索 SqlTrackingWorkflowInstance

此代码示例摘自 DatabaseService.cs 文件中的“工作流监控”SDK 示例。 有关详细信息,请参阅 工作流监视器

internal bool TryGetWorkflow(Guid workflowInstanceId, out SqlTrackingWorkflowInstance sqlTrackingWorkflowInstance)
{
    SqlTrackingQuery sqlTrackingQuery = new SqlTrackingQuery(connectionString);
    return sqlTrackingQuery.TryGetWorkflow(workflowInstanceId, out sqlTrackingWorkflowInstance);
}
Friend Function TryGetWorkflow(ByVal workflowInstanceId As Guid, ByVal sqlTrackingWorkflowInstance As SqlTrackingWorkflowInstance) As Boolean
    Dim SqlTrackingQuery As New SqlTrackingQuery(connectionString)
    Return SqlTrackingQuery.TryGetWorkflow(workflowInstanceId, sqlTrackingWorkflowInstance)
End Function

适用于

另请参阅