TrackingService.TryReloadProfile(Type, Guid, TrackingProfile) 方法

定义

必须在派生类中重写,并且在实现后为指定的工作流实例检索新的跟踪配置文件(如果跟踪配置文件自上次加载后已更改)。Must be overridden in the derived class, and when implemented, retrieves a new tracking profile for the specified workflow instance if the tracking profile has changed since it was last loaded.

protected public:
 abstract bool TryReloadProfile(Type ^ workflowType, Guid workflowInstanceId, [Runtime::InteropServices::Out] System::Workflow::Runtime::Tracking::TrackingProfile ^ % profile);
protected internal abstract bool TryReloadProfile (Type workflowType, Guid workflowInstanceId, out System.Workflow.Runtime.Tracking.TrackingProfile profile);
abstract member TryReloadProfile : Type * Guid * TrackingProfile -> bool
Protected Friend MustOverride Function TryReloadProfile (workflowType As Type, workflowInstanceId As Guid, ByRef profile As TrackingProfile) As Boolean

参数

workflowType
Type

工作流实例的 TypeThe Type of the workflow instance.

workflowInstanceId
Guid

工作流实例的 GuidThe Guid of the workflow instance.

profile
TrackingProfile

此方法返回时,将包含要加载的 TrackingProfileWhen this method returns, contains the TrackingProfile to load. 此参数未经初始化即被传递。This parameter is passed uninitialized.

返回

Boolean

如果应加载新的 TrackingProfile,则为 true;否则为 falsetrue if a new TrackingProfile should be loaded; otherwise, false. 如果为 true,则会在 TrackingProfile 中返回 profileIf true, the TrackingProfile is returned in profile.

示例

下面的示例演示 TryReloadProfile 方法的基本实现。The following example shows a basic implementation of the TryReloadProfile method. 此示例摘自“终止跟踪服务”SDK 示例。This example is from the Termination Tracking Service SDK sample. 有关详细信息,请参阅 终止跟踪服务示例For more information, see Termination Tracking Service Sample.

/// <summary>
/// Always returns false; this tracking service has no need to reload its tracking profile for a running instance.
/// </summary>
/// <param name="workflowType"></param>
/// <param name="workflowInstanceId"></param>
/// <param name="profile"></param>
/// <returns></returns>
protected override bool TryReloadProfile(Type workflowType, Guid workflowInstanceId, out TrackingProfile profile)
{
    //
    // There is no reason for this service to ever reload a profile
    profile = null;
    return false;
}
' Always returns false me tracking service has no need to reload its tracking profile for a running instance.
' <param name="workflowType"></param>
' <param name="workflowInstanceId"></param>
' <param name="profile"></param>
' <returns></returns>
Protected Overrides Function TryReloadProfile(ByVal workflowType As Type, ByVal workflowInstanceId As Guid, ByRef profile As TrackingProfile) As Boolean
    '
    ' There is no reason for me service to ever reload a profile
    profile = Nothing
    Return False
End Function

注解

运行时跟踪基础结构调用 TryReloadProfile 以确定是否应为指定的工作流实例加载新的 TrackingProfileTryReloadProfile is called by the run-time tracking infrastructure to determine whether a new TrackingProfile should be loaded for the specified workflow instance. 如果需要新的 TrackingProfile,它将在 profile 中返回。If a new TrackingProfile is required, it is returned in profile. 如果希望运行时跟踪基础结构停止跟踪某个工作流实例,则跟踪服务应返回 true,并将 profile 设置为等于空引用(在 Visual Basic 中为 Nothing)。If you want the run-time tracking infrastructure to stop tracking a workflow instance, your tracking service should return true and set profile equal to a null reference (Nothing in Visual Basic). 跟踪服务可以采用您选择的任何方式使用 workflowTypeworkflowInstanceId,以确定是否应重新加载跟踪配置文件。Your tracking service can use workflowType or workflowInstanceId in whatever manner you choose to determine whether a tracking profile should be reloaded. 例如,SqlTrackingService 只使用 workflowInstanceId 来决定是否应重新加载跟踪配置文件。For example, the SqlTrackingService only uses workflowInstanceId to decide whether the tracking profile should be reloaded. 运行时跟踪基础结构根据其自己的跟踪语义或响应对工作流实例调用 TryReloadProfile 的宿主或服务,以调用 WorkflowInstance.ReloadTrackingProfilesTryReloadProfile is called by the run-time tracking infrastructure according to its own tracking semantics, or in response to the host or a service calling WorkflowInstance.ReloadTrackingProfiles on a workflow instance.

适用于