开发者

What are the implications of storing a linq2sql object in a workflow instance

开发者 https://www.devze.com 2023-04-12 12:14 出处:网络
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 work

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号