Worflow Instance ID as Primary Key
Suppose you have a simple Purchase Ordering application, built using Workflow Foundation. Since each PO can have multiple statuses (created, authorized, sent) this problem is best suited to be solved using state-machine workflow. Now each status change of PO can happen in hours/days/months, as PO may get created today, but since manager is off to Hawaii he will only see it after two weeks’ off. This means particular PO’s workflow will get persisted. To have it get back from persistence state, we need to have workflow’s instance ID. I was thinking about adding an additional field in PO table in database, named as ‘POWorkflowID’, until I read this thanks to this post at ‘Coding Horror’. That is, I will not have POId as Primary Key, rather Workflow Instance ID will act as a primary key of my Purchase Order table. Good idea, isn’t it!