使用具有ISerializable类型属性的自定义活动对XOML进行序列化/反序列化 [英] Serializaing/deserializing XOMLs with custom activities that have properties of ISerializable types

查看:103
本文介绍了使用具有ISerializable类型属性的自定义活动对XOML进行序列化/反序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有自定义活动,它们具有实现ISerializable的类型的依赖项属性。将它们序列化/反序列化为XOML时,将忽略ISerializable隐含的功能,并调用基于标准反射的SerializableAttribute行为。这提出了一个严重的问题,因为类型需要对其序列化进行精确控制,以确保在序列化边界内保持适当的内部状态。

我知道WF 自定义序列化方法,但它们似乎需要 DesignerSerializerAttribute 属性,适用于所有自定义类型。这是一个问题,因为类型是在许多(非WF)应用程序之间共享的业务对象,它们是我无法访问的单独代码库的一部分。是否有不同的方法来获取自定义序列化? WF团队选择忽略整个框架中每个其他.NET API支持的基本ISerializable属性的原因是什么?

提前谢谢。

I have custom activities that have dependency properties of types that implement ISerializable. When they are serialized/deserialized to XOML, the ISerializable-implied functionality is ignored and the standard reflection-based SerializableAttribute behavior is invoked. This poses a serious problem since the types require precise control over their serialization to ensure that proper internal state is maintained across serialization boundaries.

I am aware of the WF custom serialization methods as mentioned in Tom Lakes' blog post, but they seem to require the DesignerSerializerAttribute attribute on all custom types. This is a problem because the types are business objects shared across many (non-WF) applications and they are part of a seperate code base to which I have no access. Is there a different method for getting custom serialization? And what is the reasoning behind the WF team choosing to ignore the very basic ISerializable attribute which is supported by every other .NET API across the framework?

Thanks in advance.

推荐答案

ISerializable接口用于对象的运行时序列化/反序列化,例如,当正在运行的工作流实例持久化到数据库时使用。
相反,DesignerSerializerAttribute用于设计时序列化工作流定义到XOML或代码,而不是运行时持久性。我希望这种区别有助于澄清这些结构的目的和用途。
The ISerializable interface is for runtime serialization/deserialization of objects and is used when a running workflow instance is persisted to a database for example.
In contrast, the DesignerSerializerAttribute is for design time serialization of workflow definitions to XOML or code and not runtime persistence.
I hope this distinction helps clarify the purpose and use of these constructs.


这篇关于使用具有ISerializable类型属性的自定义活动对XOML进行序列化/反序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆