共用方式為


TrackingProfile.WorkflowTrackPoints 屬性

定義

取得執行階段追蹤基礎結構用來篩選工作流程狀態事件的工作流程追蹤點集合。

public:
 property System::Workflow::Runtime::Tracking::WorkflowTrackPointCollection ^ WorkflowTrackPoints { System::Workflow::Runtime::Tracking::WorkflowTrackPointCollection ^ get(); };
public System.Workflow.Runtime.Tracking.WorkflowTrackPointCollection WorkflowTrackPoints { get; }
member this.WorkflowTrackPoints : System.Workflow.Runtime.Tracking.WorkflowTrackPointCollection
Public ReadOnly Property WorkflowTrackPoints As WorkflowTrackPointCollection

屬性值

WorkflowTrackPointCollection,可指定工作流程執行個體中的點,執行階段追蹤基礎結構會傳送這些點的 WorkflowTrackingRecord 至追蹤服務。

範例

下列程式碼範例將示範如何使用 TrackingProfile 建構函式建立 TrackingProfile,並使用物件的屬性協助追蹤工作流程的執行。 此範例程式碼會使用 ActivityTrackPointsVersionWorkflowTrackPoints 屬性。

這個程式碼範例是 Program.cs 檔案中<使用 SQLTrackingService 查詢 SDK>範例的一部分。 如需詳細資訊,請參閱 使用 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

備註

每當發生 TrackingWorkflowEvent 時,工作流程執行個體都會發出工作流程狀態事件到執行階段追蹤基礎結構,表示工作流程執行個體的狀態已變更。 執行階段追蹤基礎結構會使用 WorkflowTrackPoints 屬性篩選這些工作流程狀態事件,以判斷何時傳送 WorkflowTrackingRecord 至追蹤服務。 您可以加入 WorkflowTrackPointWorkflowTrackPoints 屬性中,以指定您所需要的點;這些點位於工作流程執行個體的可能執行路徑中,而且您想要傳送這個執行個體的 WorkflowTrackingRecord

WorkflowTrackPoint 不會實際定義工作流程執行個體中的實體點,而會定義一個或多個 TrackingWorkflowEvent 值,讓執行階段追蹤基礎結構用來比對工作流程狀態事件。 因此,在工作流程執行個體的存留期間內,可以多次比對相同的 WorkflowTrackPointWorkflowTrackPoint 也可以指定要在 WorkflowTrackingRecord 中傳回的任何附註。

適用於

另請參閱