0
votes

Given that in Workflow Foundation, a "Workflow Instance" stores the information about how far through the workflow that instance is, how would people recommend reporting on that?

Contrived Example
Consider a workflow for repairing a PC. It has simple states: Investigating, Obtaining parts, Repairing, Returning.

In theory I might also have in my database a table called RepairJob, where each record relates to the job. There will be foreign keys to technicians, skus etc.

However, I might want to query RepairJobs by their current state:

select * from RepairJob where StatusId = @statusId

But effectively this means somehow duplicating the current "state" of a RepairJob both in the workflow instance and in the database. It means that my workflow actions need to do something when activated that fires off the database update.

Is this the accepted use for Workflow Foundation? How are other people using it?

Many thanks in advance.

1

1 Answers

0
votes

Yes, you can do it like that with a workflow and a status table.

The simple way to do it is just to have a "Update Status Table" activity as every second activity in your workflow.

If you wanted to do a bit more elegant solution you could create a custom activity that had a property of which status it was, and automatically updated the status table. But that is probably more work than it is worth.