แก้ไข

แชร์ผ่าน


TrackingService.TryReloadProfile(Type, Guid, TrackingProfile) Method

Definition

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

Parameters

workflowType
Type

The Type of the workflow instance.

workflowInstanceId
Guid

The Guid of the workflow instance.

profile
TrackingProfile

When this method returns, contains the TrackingProfile to load. This parameter is passed uninitialized.

Returns

true if a new TrackingProfile should be loaded; otherwise, false. If true, the TrackingProfile is returned in profile.

Examples

The following example shows a basic implementation of the TryReloadProfile method. 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

Remarks

TryReloadProfile is called by the run-time tracking infrastructure to determine whether a new TrackingProfile should be loaded for the specified workflow instance. If a new TrackingProfile is required, it is returned in profile. 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). Your tracking service can use workflowType or workflowInstanceId in whatever manner you choose to determine whether a tracking profile should be reloaded. For example, the SqlTrackingService only uses workflowInstanceId to decide whether the tracking profile should be reloaded. TryReloadProfile 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.

Applies to