DataSnap“普通旧 Delphi 对象”和嵌套对象
一篇关于 Delphi XE 中 DataSnap 的新文章解释说 DataSnap 现在能够传输 TObject 后代服务器和客户端之间的交互,类似于 Java 企业版 POJO 的概念(“普通旧 Java 对象”)。
如果这样的 PODO 具有需要初始化的嵌套对象类型属性(例如 TStrings 属性),那么此新功能是否有效?所有这些子对象都会被序列化并以其当前值传输吗?系统资源属性(例如 TFileStream、THandle 或 TThread)在序列化对象中没有任何意义,可以将它们标记为“不可序列化”吗?
一些信息位于 DocWiki 中,包括:
这些是有的字段 已经是内置的 转换/恢复:整数、字符串、 字符、枚举、浮点数、对象、 记录。对于以下类型, 字段值被忽略并且用户 预期转换:集合、方法、 变体、接口、指针、dynArray、 类引用,数组。
A new article about DataSnap in Delphi XE explains that DataSnap now is able to transfer TObject-descendants between server and client, similar to the Java Enterprise Edition concept of POJO's ("Plain old Java objects").
Does this new feature work if such a PODO has a nested object-type properties which needs to be initialized, for example a TStrings property? Will all of these sub-objects be serialized and transferred with their current values? What about system resource properties, like TFileStream, THandle or TThread, which would make no sense in a serialized object, can these be tagged as 'not serializable'?
Some information is in the DocWiki, including this:
These are the fields for which there
is already a built-in
conversion/reversion: integer, string,
char, enumeration, float, object,
record. For the following types, the
field values are ignored and user
conversion is expected: set, method,
variant, interface, pointer, dynArray,
classRef, array.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己还没有尝试过,但阅读了文档,它似乎会序列化几乎所有内容,尽管您可能需要编写一个自定义转换器。以下包含子对象的代码作为需要自定义转换器的对象的示例给出。
I haven't tried myself but reading the documentation it appears it will serialize just about anything although you may need to write a custom convertor. The following code which contains sub-objects is given as an example of an object requiring a custom convertor.