tags:

views:

70

answers:

1

Is it possible to make a Workflow not unload when it has become idle?

+1  A: 

Are you talking about SQL persistence? You could just not add the SqlPersistenceService, but that would affect all workflow instances, so might not be a good idea.

I'm not sure you'd want to do this, though. Workflow Foundation uses the threadpool to process workflow instances, so if you keep a workflow instance "alive" longer than necessary, it's taking up a threadpool thread. While performance isn't great in WF 3.0, I'm not sure this is a good approach to fixing it. WF 4.0 has (allegedly) much better performance, assuming that's your goal?

The workflow will be unloaded when it becomes idle - that's just what happens. If you have added the SqlPersistenceService, then it will be persisted to SQL Server, otherwise it's just kept in memory while the thread is returned to the threadpool. You can't change this behaviour AFAIK.

Neil Barnwell
Maybe my question isn't phrased correctly. I can not add the SqlPersistenceService, but the workflow is still unloaded.
Joe
The workflow will be unloaded when it becomes idle - that's just what happens. If you have added the SqlPersistenceService, then it will be persisted to SQL Server, otherwise it's just kept in memory while the thread is returned to the threadpool. You can't change this behaviour AFAIK.
Neil Barnwell