TrackingService.TryGetProfile(Type, TrackingProfile) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Must be overridden in the derived class, and when implemented, retrieves the tracking profile for the specified workflow type if one is available.
protected public:
abstract bool TryGetProfile(Type ^ workflowType, [Runtime::InteropServices::Out] System::Workflow::Runtime::Tracking::TrackingProfile ^ % profile);
protected internal abstract bool TryGetProfile (Type workflowType, out System.Workflow.Runtime.Tracking.TrackingProfile profile);
abstract member TryGetProfile : Type * TrackingProfile -> bool
Protected Friend MustOverride Function TryGetProfile (workflowType As Type, ByRef profile As TrackingProfile) As Boolean
Parameters
- profile
- TrackingProfile
When this method returns, contains the TrackingProfile to load. This parameter is passed uninitialized.
Returns
true
if a TrackingProfile for the specified workflow Type is available; otherwise, false
. If true
, the TrackingProfile is returned in profile
.
Examples
The following example demonstrates an implementation of the TryGetProfile
method, which calls a private GetProfile
method. This example is from the Termination Tracking Service SDK sample. For more information, see Termination Tracking Service Sample.
class OrderServiceImpl : IOrderService
{
string orderId;
public WorkflowInstance instanceId;
// Called by the workflow to pass an order id
public void CreateOrder(string Id)
{
Console.WriteLine("\nPurchase Order Created in System");
orderId = Id;
}
// Called by the host to approve an order
public void ApproveOrder()
{
EventHandler<OrderEventArgs> orderApproved = this.OrderApproved;
if (orderApproved != null)
orderApproved(null, new OrderEventArgs(instanceId.InstanceId, orderId));
}
// Called by the host to reject an order
public void RejectOrder()
{
EventHandler<OrderEventArgs> orderRejected = this.OrderRejected;
if (orderRejected != null)
orderRejected(null, new OrderEventArgs(instanceId.InstanceId, orderId));
}
// Events that handled within a workflow by HandleExternalEventActivity activities
public event EventHandler<OrderEventArgs> OrderApproved;
public event EventHandler<OrderEventArgs> OrderRejected;
}
Class OrderServiceImpl
Implements IOrderService
Dim orderId As String
Public instanceId As WorkflowInstance
' Called by the workflow to pass an order id
Public Sub CreateOrder(ByVal Id As String)
Console.WriteLine("\nPurchase Order Created in System")
orderId = Id
End Sub
' Called by the host to approve an order
Public Sub ApproveOrder()
RaiseEvent OrderApproved(Nothing, New OrderEventArgs(instanceId.InstanceId, orderId))
End Sub
' Called by the host to reject an order
Public Sub RejectOrder()
RaiseEvent OrderRejected(Nothing, New OrderEventArgs(instanceId.InstanceId, orderId))
End Sub
' Events that handled within a workflow by HandleExternalEventActivity activities
Public Event OrderApproved(ByVal sender As Object, ByVal e As OrderEventArgs) Implements IOrderService.OrderApproved
Public Event OrderRejected(ByVal sender As Object, ByVal e As OrderEventArgs) Implements IOrderService.OrderRejected
End Class
Remarks
A tracking service is responsible for managing the tracking profiles available for specific workflow types and specific workflow instances. You can implement this management in whatever manner you choose. For example, you can return the same TrackingProfile for every workflow Type and workflow instance; or you can manage a sophisticated store of tracking profiles referenced by workflow instance, workflow Type, and Version.