Edit

Kongsi melalui


TrackingService Class

Definition

Caution

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

Provides the basic interface between a tracking service and the run-time tracking infrastructure.

public ref class TrackingService abstract : System::Workflow::Runtime::Hosting::WorkflowRuntimeService
public abstract class TrackingService : System.Workflow.Runtime.Hosting.WorkflowRuntimeService
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public abstract class TrackingService : System.Workflow.Runtime.Hosting.WorkflowRuntimeService
type TrackingService = class
    inherit WorkflowRuntimeService
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type TrackingService = class
    inherit WorkflowRuntimeService
Public MustInherit Class TrackingService
Inherits WorkflowRuntimeService
Inheritance
TrackingService
Derived
Attributes

Remarks

Note

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

A tracking service is responsible for supplying tracking channels and tracking profiles to the workflow run-time engine. The workflow run-time engine requests one TrackingChannel from a tracking service for each workflow instance for which it has a TrackingProfile. The workflow run-time engine uses this TrackingChannel to send tracking records associated with that workflow instance. A TrackingProfile contains track points that specify a set of tracking events for which the run-time tracking infrastructure should send tracking records. A TrackingProfile may also specify data to be extracted from the workflow instance when one of these tracking events occurs.

The run-time tracking infrastructure uses a TrackingProfile to filter tracking events emitted by a workflow instance. When a tracking event is emitted that matches a track point in the TrackingProfile, the run-time tracking infrastructure extracts any data specified in the TrackingProfile from the workflow instance and encapsulates this data and information about the tracking event in a tracking record. This tracking record is then sent over the TrackingChannel associated with the workflow instance. A tracking record may be one of the following kinds:

ActivityTrackingRecord

UserTrackingRecord

WorkflowTrackingRecord

The host application can use the tracking record in any way that it chooses. For example, the host application may store the tracking information in a database and use it to implement a sophisticated user interface, or it may use the information to inform an administrator of a condition that requires some action. You can register a tracking service with the workflow run-time engine by calling WorkflowRuntime.AddService or by including the appropriate entry in the application configuration file.

All tracking services must inherit from the TrackingService abstract class. This class defines the basic interface between a tracking service and the run-time tracking infrastructure. The workflow run-time engine requests a TrackingProfile for a specific workflow instance or workflow Type by calling one of the overloaded GetProfile methods or the TryGetProfile method. The workflow run-time engine calls GetTrackingChannel to request a TrackingChannel.

The workflow tracking runtime calls the GetProfile and TryGetProfile methods whenever a workflow instance is created or loaded from the persistence store. The overhead associated with these calls can be costly to the tracking service (many database calls, for example). You can implement the IProfileNotification interface in your tracking service to circumvent this call-based mechanism and use events to notify the workflow runtime engine of changes to a TrackingProfile. For tracking services that implement the IProfileNotification interface, the workflow run-time engine subscribes to the ProfileUpdated and ProfileRemoved events. Your tracking service can raise the appropriate event when a change to one of its tracking profiles occurs. The SqlTrackingService class implements this interface.

The workflow run-time engine calls the TryReloadProfile method to test whether a TrackingProfile has been updated or removed as a result of an explicit call by a host or a service to ReloadTrackingProfiles on a workflow instance. This process enables a host or service to dynamically change the tracking profile that is being used for a specific workflow instance.

Notes to Implementers

Constructors

TrackingService()

When implemented in a derived class, initializes a new instance of the TrackingService class.

Properties

Runtime

Gets the WorkflowRuntime for this service.

(Inherited from WorkflowRuntimeService)
State

Gets the state of the WorkflowRuntimeService.

(Inherited from WorkflowRuntimeService)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetProfile(Guid)

Must be overridden in the derived class, and when implemented, returns the tracking profile for the specified workflow instance.

GetProfile(Type, Version)

Must be overridden in the derived class, and when implemented, returns the tracking profile, qualified by version, for the specified workflow Type.

GetTrackingChannel(TrackingParameters)

Must be overridden in the derived class, and when implemented, returns the channel that the run-time tracking infrastructure uses to send tracking records to the tracking service.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnStarted()

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the Started event.

(Inherited from WorkflowRuntimeService)
OnStopped()

When overridden in a derived class, represents the method that will be called when the workflow runtime engine raises the Stopped event.

(Inherited from WorkflowRuntimeService)
RaiseServicesExceptionNotHandledEvent(Exception, Guid)

Raises the ServicesExceptionNotHandled event.

(Inherited from WorkflowRuntimeService)
Start()

When overridden in a derived class, starts the service and changes the State to Starting.

(Inherited from WorkflowRuntimeService)
Stop()

When overridden in a derived class, stops the service and changes the State to Stopping.

(Inherited from WorkflowRuntimeService)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryGetProfile(Type, TrackingProfile)

Must be overridden in the derived class, and when implemented, retrieves the tracking profile for the specified workflow type if one is available.

TryReloadProfile(Type, Guid, TrackingProfile)

Must be overridden in the derived class, and when implemented, retrieves a new tracking profile for the specified workflow instance if the tracking profile has changed since it was last loaded.

Applies to

See also