TrackingService.GetProfile メソッド

定義

派生クラス内でオーバーライドされる必要があります。実装されると、特定のワークフロー インスタンスまたはワークフロー型に関する追跡プロファイルを取得します。

オーバーロード

GetProfile(Guid)

派生クラス内でオーバーライドされる必要があります。実装されると、特定のワークフロー インスタンスに関する追跡プロファイルを返します。

GetProfile(Type, Version)

派生クラス内でオーバーライドされる必要があります。実装されると、バージョンで修飾された、特定のワークフロー Type に関する追跡プロファイルを返します。

注釈

追跡サービスは、特定の種類のワークフローとインスタンスに利用できる追跡プロファイルを管理します。 この管理機能は、どのような方法でも実装できます。 たとえば、すべてのワークフローの TrackingProfile およびワークフロー インスタンスに対して同じ Type を返すことができます。また、ワークフロー インスタンス、ワークフローの Type、および Version によって参照される追跡プロファイルの保存場所を管理することもできます。

GetProfile(Guid)

派生クラス内でオーバーライドされる必要があります。実装されると、特定のワークフロー インスタンスに関する追跡プロファイルを返します。

protected public:
 abstract System::Workflow::Runtime::Tracking::TrackingProfile ^ GetProfile(Guid workflowInstanceId);
protected internal abstract System.Workflow.Runtime.Tracking.TrackingProfile GetProfile (Guid workflowInstanceId);
abstract member GetProfile : Guid -> System.Workflow.Runtime.Tracking.TrackingProfile
Protected Friend MustOverride Function GetProfile (workflowInstanceId As Guid) As TrackingProfile

パラメーター

workflowInstanceId
Guid

ワークフロー インスタンスの Guid

戻り値

TrackingProfile

指定されたワークフロー インスタンスの追跡プロファイル。

GetProfile メソッドを実装する例を次に示します。 この例では、GetProfile メソッドのいくつかのオーバーロードが 1 つのプライベート GetProfile メソッドを呼び出します。このメソッドは、ハードコーディングされた既定の追跡プロファイルを返します。 この例は、終了追跡サービスの SDK サンプルです。 詳細については、「 終了追跡サービスのサンプル」を参照してください。

/// <summary>
/// Returns a static tracking profile that only tracks instance terminated events.
/// </summary>
protected override TrackingProfile GetProfile(Guid workflowInstanceId)
{
    return GetProfile();
}
private volatile static TrackingProfile profile = null;
private bool sourceExists = false;
private TrackingProfile GetProfile()
{
    //
    // We shouldn't hit this point without the host ignoring an earlier exception.
    // However if we're here and the source doesn't exist we can't function.
    // Throwing an exception from here will block instance creation
    // but that is better than failing silently on termination
    // and having the admin think everything is OK because the event log is clear.
    if (!sourceExists)
        throw new InvalidOperationException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "EventLog Source with the name '{0}' does not exist", source));

    //
    // The profile for this instance will never change
    if (null == profile)
    {
        lock (typeof(TerminationTrackingService))
        {
            if (null == profile)
            {
                profile = new TrackingProfile();
                profile.Version = new Version("3.0.0.0");
                WorkflowTrackPoint point = new WorkflowTrackPoint();
                point.MatchingLocation = new WorkflowTrackingLocation();
                point.MatchingLocation.Events.Add(TrackingWorkflowEvent.Terminated);
                profile.WorkflowTrackPoints.Add(point);
            }
        }
    }
    return profile;
}
'/ <summary>
'/ Returns a Shared tracking profile that only tracks instance terminated events.
'/ </summary>
Protected Overrides Function GetProfile(ByVal workflowInstanceId As Guid) As TrackingProfile
    Return GetProfile()
End Function

Private Shared profile As TrackingProfile = Nothing
Private sourceExists As Boolean = False
Private Overloads Function GetProfile() As TrackingProfile

    '
    ' We shouldn't hit me point without the host ignoring an earlier exception.
    ' However if we're here and the source doesn't exist we can't function.
    ' Throwing an exception from here will block instance creation
    ' but that is better than failing silently on termination 
    ' and having the admin think everything is OK because the event log is clear.
    If Not sourceExists Then
        Throw New InvalidOperationException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "EventLog Source with the name '0}' does not exist", source))
    End If
    '
    ' The profile for me instance will never change
    If profile Is Nothing Then

        SyncLock (GetType(TerminationTrackingService))

            If profile Is Nothing Then

                profile = New TrackingProfile()
                profile.Version = New Version("3.0.0.0")
                Dim point As New WorkflowTrackPoint()
                point.MatchingLocation = New WorkflowTrackingLocation()
                point.MatchingLocation.Events.Add(TrackingWorkflowEvent.Terminated)
                profile.WorkflowTrackPoints.Add(point)
            End If
        End SyncLock

    End If

    Return profile
End Function

注釈

追跡サービスは、特定の種類のワークフローとインスタンスに利用できる追跡プロファイルを管理します。 この管理機能は、どのような方法でも実装できます。 たとえば、すべてのワークフローの TrackingProfile およびワークフロー インスタンスに対して同じ Type を返すことができます。また、ワークフロー インスタンス、ワークフローの Type、および Version によって参照される追跡プロファイルの保存場所を管理することもできます。

適用対象

GetProfile(Type, Version)

派生クラス内でオーバーライドされる必要があります。実装されると、バージョンで修飾された、特定のワークフロー Type に関する追跡プロファイルを返します。

protected public:
 abstract System::Workflow::Runtime::Tracking::TrackingProfile ^ GetProfile(Type ^ workflowType, Version ^ profileVersionId);
protected internal abstract System.Workflow.Runtime.Tracking.TrackingProfile GetProfile (Type workflowType, Version profileVersionId);
abstract member GetProfile : Type * Version -> System.Workflow.Runtime.Tracking.TrackingProfile
Protected Friend MustOverride Function GetProfile (workflowType As Type, profileVersionId As Version) As TrackingProfile

パラメーター

workflowType
Type

ワークフローの Type

profileVersionId
Version

追跡プロファイルの Version

戻り値

TrackingProfile

指定されたワークフロー型の追跡プロファイル。

注釈

追跡サービスは、特定の種類のワークフローとインスタンスに利用できる追跡プロファイルを管理します。 この管理機能は、どのような方法でも実装できます。 たとえば、すべてのワークフローの TrackingProfile およびワークフロー インスタンスに対して同じ Type を返すことができます。また、ワークフロー インスタンス、ワークフローの Type、および Version によって参照される追跡プロファイルの保存場所を管理することもできます。

適用対象