I've been trying to use WF in my ASP.NET application (actually, it's ASP.NET MVC .. but the fact that it's MVC instead of WebForms should not matter at all).
Now, i can run the WF and it works fine, etc.. but it kicks off ASYNCRONOUSLY, so any results from the WF (good or bad) get lost page life cycle.
So .. after crying like an emo for ages, i stumbled across this gem on MSDN!
If you've click that link, that MSDN article says that in ASP.NET applications, we need to
- Put the
WorkflowRuntime
into the Application state - The
WorkflowRuntime
instance has aManualWorkflowSchedulerService
added to it (whatever that is). - Use this application state workflow instance when required.
this is opposed to (the way i learnt)
- Make the WorkflowRuntime a static object, that is first created when required.
- Use this static WorkflowRuntime instance on the new workflow u are going to run.
So .. which way is better? do we need to stick it into the application? What are the differences between either/or?
I understand there's actually TWO questions here...
- Application state vs static object (using lock/null or double null checking)
- DefaultWorldFlowSchedulerService vs ManualWorldFlowSchedulerService
cheers!
EDIT:
- First question is answered here.
- Second question is answered below.