I was able to load a linq2sql objects into my workflow service instance, and was able to access the values from those objects with no problems. How开发者_JAVA技巧ever, what I noticed was that the workflow activities I created that loaded those objects were being called unexpectedly on receives, AND my workflow did not operate as it should.
My suspicion was that it is an issue with serializability. When I eliminated the storage of the objects, but just stored some selected "values" from the object (simple types - bool, int) the extra calls went away, and the workflow began to operate properly.
So - any ideas about why I might have seen these issues? Does anyone really KNOW whether it was serialization related or note?
Thoughts?
I believe L2S uses events for change tracking purposes by default so the entities used in the workflow actually contain references back to the L2S context object. And with serialization it will try to serialize all that and reload it later, something that doesn't work. The best thing is to use simple DTO objects that can be safely serialized and deserialized as part of the workflow state.
精彩评论