问题
I'm evaluating whether WF would be a good fit for a design I'm working on. I'm in that chicken-and-egg conundrum where I don't want to invest too much time in learning all the details until I have a good idea that it's going to be suitable.
The one thing that I can't seem to find much on that could be significant is scheduling. And by that I mean scheduling of activities to start at a certain time.
E.g. I have a workflow that, on starting, executes the first two activities - but then must wait until, say, 9am the next day before continuing.
I realise I could achieve the same effect by splitting this into two workflows - with the second triggered by, say, a scheduled task. But that would lose much of the benefits of having workflows in the first place - such as seamless persistence of state between activities and guaranteed ordering.
So is there a way to achieve this in a single workflow? Preferably built in to WF (e.g. a WaitUntil activity) - but an alternative might be that the workflow sleeps until recieving an external prod.
回答1:
A Delay activity where you calculate the duration will do that just fine.
回答2:
You can easily accomplish this if you host your Workflow in IIS on WCF with an delay activity adding SQL Persistance to the workflow as well
来源:https://stackoverflow.com/questions/3837950/windows-workflow-foundation-schedule-activities-to-run-at-certain-times