Explicitly persist states in Workflow 4.0 rather than everything.

Posted by jlafay on Stack Overflow See other posts from Stack Overflow or by jlafay
Published on 2010-06-14T18:37:06Z Indexed on 2010/06/14 18:42 UTC
Read the original article Hit count: 179

I have ran into an issue with my SQL instance store attached to a WorkflowApplication that is running. When I exit my application I'm calling an Unload() on the WF app to persist it. I didn't think about it during design time, but it does makes sense, it's persisting an arg that was passed in to the WorkflowApplication constructor when instanced.

When the application runs, everything in the workflow works as expected. When I call Unload() I get an unhandled exception that states that the arg is not serializable and needs [DataContractAttribute].

What's passed into the workflow is my applications custom logger object that I wrote so that the WF can log to disk in a uniform way that I prefer. How do I prevent the workflow app from persisting this one argument and persist everything else?

I'm sure something can be done with extensions but I'm having a hard time finding info on them or finding persistence examples for my scenario.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .net-4.0