Partager via


TrackingService.GetProfile Méthode

Définition

Doit être substitué dans la classe dérivée et, en cas d'implémentation, obtient le modèle de suivi pour une instance de workflow ou un type de workflow spécifié.

Surcharges

GetProfile(Guid)

Doit être substitué dans la classe dérivée et, en cas d'implémentation, retourne le modèle de suivi pour l'instance de workflow spécifiée.

GetProfile(Type, Version)

Doit être substitué dans la classe dérivée et, en cas d'implémentation, retourne le modèle de suivi, qualifié par version, pour le Type de workflow spécifié.

Remarques

Un service de suivi est chargé de gérer les profils de suivi disponibles pour des types de workflow spécifiques et des instances de workflow spécifiques. Vous pouvez implémenter cette gestion comme bon vous semble. Par exemple, vous pouvez retourner le même TrackingProfile pour chaque Type de workflow et instance de workflow ; ou vous pouvez gérer un magasin de profils de suivi sophistiqué référencé par instance de workflow, Type de workflow et Version.

GetProfile(Guid)

Doit être substitué dans la classe dérivée et, en cas d'implémentation, retourne le modèle de suivi pour l'instance de workflow spécifiée.

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

Paramètres

workflowInstanceId
Guid

Guid de l'instance de workflow.

Retours

Modèle de suivi pour l'instance de flux de travail spécifié.

Exemples

L'exemple suivant illustre une implémentation de la méthode GetProfile. Dans cet exemple, plusieurs surcharges de la GetProfile méthode appellent une seule méthode privée GetProfile , qui retourne un profil de suivi par défaut codé en dur. Cet exemple provient de l'exemple du Kit de développement logiciel Termination Tracking Service (SDK). Pour plus d’informations, consultez Exemple de service de suivi des interruptions.

/// <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

Remarques

Un service de suivi est chargé de gérer les profils de suivi disponibles pour des types de workflow spécifiques et des instances de workflow spécifiques. Vous pouvez implémenter cette gestion comme bon vous semble. Par exemple, vous pouvez retourner le même TrackingProfile pour chaque Type de workflow et instance de workflow ; ou vous pouvez gérer un magasin de profils de suivi sophistiqué référencé par instance de workflow, Type de workflow et Version.

S’applique à

GetProfile(Type, Version)

Doit être substitué dans la classe dérivée et, en cas d'implémentation, retourne le modèle de suivi, qualifié par version, pour le Type de workflow spécifié.

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

Paramètres

workflowType
Type

Type du workflow.

profileVersionId
Version

Version du modèle de suivi.

Retours

Modèle de suivi pour le type de flux de travail spécifié.

Remarques

Un service de suivi est chargé de gérer les profils de suivi disponibles pour des types de workflow spécifiques et des instances de workflow spécifiques. Vous pouvez implémenter cette gestion comme bon vous semble. Par exemple, vous pouvez retourner le même TrackingProfile pour chaque Type de workflow et instance de workflow ; ou vous pouvez gérer un magasin de profils de suivi sophistiqué référencé par instance de workflow, Type de workflow et Version.

S’applique à