Share via


TrackingProfile.Version Vlastnost

Definice

Získá nebo nastaví verzi profilu sledování.

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

Hodnota vlastnosti

The Version of the TrackingProfile.

Příklady

Následující příklad kódu ukazuje, jak můžete vytvořit TrackingProfile pomocí konstruktoru TrackingProfile a použít vlastnosti objektu ke sledování provádění pracovního postupu. Ukázkový kód používá ActivityTrackPointsvlastnosti , Versiona WorkflowTrackPoints .

Tento příklad kódu je součástí ukázky dotazu pomocí sady SQLTrackingService SDK ze souboru Program.cs. Další informace najdete v tématu Dotazování pomocí služby 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

Poznámky

Vzhledem k sémantice ukládání profilů do mezipaměti v modulu runtime pracovního postupu, pokud změníte obsah objektu TrackingProfile , musíte aktualizovat Version. Pokud to neuděláte, váš aktualizovaný TrackingProfile modul modulu runtime pracovního postupu nemusí být načten, i když je vrácen voláním TrackingService.TryReloadProfilenebo odeslán v ProfileUpdatedEventArgs přidružené k ProfileUpdated události. Proto pokud chcete zajistit, aby se aktualizace TrackingProfile načetla modulem modulu runtime pracovního postupu, měli byste změnit Version pro TrackingProfile. Pak můžete explicitně volat WorkflowInstance.ReloadTrackingProfiles libovolné odpovídající instance pracovního postupu, nebo, v závislosti na implementaci, můžete spoléhat na sledovací službu, která informuje modul runtime pracovního postupu o změně. Další informace naleznete v tématu TrackingService.

Platí pro

Viz také