Reputation: 5394
How do I determine from the host if a workflow instance has compled or not besides subscribing to the WorkfloRuntime's WorkflowCompleted event? Is there any flag or state I can check for a given WorflowInstance to determine if it has completed?
@Edit: The question is about sequential workflows.
Upvotes: 1
Views: 1217
Reputation: 5394
The answer (at least for know, from what I've learned) is that there's no flag associated with a WorkflowInstance that you can retrieve for a given instance indicating whether the instance has completed.
The two approaches available are:
Using a TrackingService service to keep a 'log' of workflow execution and quering the log to destermine if a workflow instance has completed. Here is a good introductory article. With this approach the only available out-of-the-box implementation of TrackingService is SqlTrackingService, which requires a SQL Server database. You can then use SqlTrackingQuery to query the 'log'
Note: An interesting aspect of the behaviour of SqlTrackingService is that it won't by default immediatly write the messages it receives from the runtime to the database, but only at the end of transactions. This behaviour is controlled by IsTransactional property of SqlTrackingService.
Upvotes: 0
Reputation: 57956
You can to check TrackingServices
to know what current state for a workflow instance.
There are some code snippets here: .NET 3.0 State Machines In Windows Workflow .
Upvotes: 1