Compartilhar via


TrackingProfile.Version Propriedade

Definição

Obtém ou define a versão do perfil de acompanhamento.

public:
 property Version ^ Version { Version ^ get(); void set(Version ^ value); };
public Version Version { get; set; }
member this.Version : Version with get, set
Public Property Version As Version

Valor da propriedade

O Version do TrackingProfile.

Exemplos

O exemplo de código a seguir demonstra como você pode criar um TrackingProfile usando o TrackingProfile construtor e usar as propriedades do objeto para ajudar a acompanhar a execução de um fluxo de trabalho. O código de exemplo usa as ActivityTrackPointspropriedades , Versione WorkflowTrackPoints .

Este exemplo de código faz parte da consulta usando o exemplo do SDK do SQLTrackingService do arquivo Program.cs. Para obter mais informações, consulte Consulta usando SQLTrackingService.

private static void CreateAndInsertTrackingProfile()
{
    TrackingProfile profile = new TrackingProfile();
    ActivityTrackPoint activityTrack = new ActivityTrackPoint();
    ActivityTrackingLocation activityLocation = new ActivityTrackingLocation(typeof(Activity));
    activityLocation.MatchDerivedTypes = true;
    IEnumerable<ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable<ActivityExecutionStatus>;
    foreach (ActivityExecutionStatus status in statuses)
    {
        activityLocation.ExecutionStatusEvents.Add(status);
    }

    activityTrack.MatchingLocations.Add(activityLocation);
    profile.ActivityTrackPoints.Add(activityTrack);
    profile.Version = version;

    WorkflowTrackPoint workflowTrack = new WorkflowTrackPoint();
    WorkflowTrackingLocation workflowLocation = new WorkflowTrackingLocation();
    IEnumerable<TrackingWorkflowEvent> eventStatuses = Enum.GetValues(typeof(TrackingWorkflowEvent)) as IEnumerable<TrackingWorkflowEvent>;
    foreach (TrackingWorkflowEvent status in eventStatuses)
    {
        workflowLocation.Events.Add(status);
    }

    workflowTrack.MatchingLocation = workflowLocation;
    profile.WorkflowTrackPoints.Add(workflowTrack);

    TrackingProfileSerializer serializer = new TrackingProfileSerializer();
    StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);
    serializer.Serialize(writer, profile);
    string trackingprofile = writer.ToString();
    InsertTrackingProfile(trackingprofile);
}
Shared Sub CreateAndInsertTrackingProfile()
    Dim profile As TrackingProfile = New TrackingProfile()

    Dim activityTrack As ActivityTrackPoint = New ActivityTrackPoint()
    Dim activityLocation As ActivityTrackingLocation = New ActivityTrackingLocation(GetType(Activity))
    activityLocation.MatchDerivedTypes = True
    Dim statuses As IEnumerable(Of ActivityExecutionStatus) = CType(System.Enum.GetValues(GetType(ActivityExecutionStatus)), IEnumerable(Of ActivityExecutionStatus))
    For Each status As ActivityExecutionStatus In statuses
        activityLocation.ExecutionStatusEvents.Add(status)
    Next

    activityTrack.MatchingLocations.Add(activityLocation)
    profile.ActivityTrackPoints.Add(activityTrack)
    profile.Version = version

    Dim workflowTrack As WorkflowTrackPoint = New WorkflowTrackPoint()
    Dim workflowLocation As WorkflowTrackingLocation = New WorkflowTrackingLocation()
    Dim eventStatuses As IEnumerable(Of TrackingWorkflowEvent) = CType(System.Enum.GetValues(GetType(TrackingWorkflowEvent)), IEnumerable(Of TrackingWorkflowEvent))
    For Each status As TrackingWorkflowEvent In eventStatuses
        workflowLocation.Events.Add(status)
    Next

    workflowTrack.MatchingLocation = workflowLocation
    profile.WorkflowTrackPoints.Add(workflowTrack)

    Dim serializer As TrackingProfileSerializer = New TrackingProfileSerializer()
    Dim writer As StringWriter = New StringWriter(New StringBuilder(), CultureInfo.InvariantCulture)
    serializer.Serialize(writer, profile)
    Dim trackingProfile As String = writer.ToString()
    InsertTrackingProfile(trackingProfile)
End Sub

Comentários

Devido à semântica do cache de perfil no mecanismo de runtime de fluxo de trabalho, se você alterar o conteúdo de um TrackingProfile , deverá atualizar Version. Se você não fizer isso, a atualização TrackingProfile poderá não ser carregada pelo mecanismo de runtime do fluxo de trabalho, mesmo que seja retornada por uma chamada para TrackingService.TryReloadProfileou enviada no associado a ProfileUpdatedEventArgs um ProfileUpdated evento. Portanto, para garantir que o atualizado TrackingProfile seja carregado pelo mecanismo de runtime do fluxo de trabalho, você deve alterar o Version para o TrackingProfile. Em seguida, você pode chamar WorkflowInstance.ReloadTrackingProfiles explicitamente quaisquer instâncias de fluxo de trabalho apropriadas ou, dependendo de sua implementação, você pode contar com o serviço de acompanhamento para informar o mecanismo de runtime de fluxo de trabalho da alteração. Para obter mais informações, consulte TrackingService.

Aplica-se a

Confira também