I'm trying to implement a custom TrackingParticipant for WF 4. I can write the Track method, but my implementation will be slow.
How can I implement the Begin/EndTrack overrides using .NET 4.0's Task Parallel Library (TPL)? I've looked at TPL and Traditional .NET Asynchronous Programming but am not sure how to apply it here.
Note that TrackingParticipant is part of .NET and has the Classic Async Pattern predefined using virtual methods.
public class MyTrackingParticipant : TrackingParticipant
{
protected override IAsyncResult BeginTrack(
TrackingRecord record, TimeSpan timeout,
AsyncCallback callback, object state)
{
// ?
}
protected override void EndTrack(IAsyncResult result)
{
// ?
}
protected override void Track(TrackingRecord record, TimeSpan timeout)
{
// synchronous code to be called
}
}
See Question&Answers more detail:os