WCF 数据服务和非基本类型
我正在尝试为 Oracle 数据库创建 WCF 数据服务。我正在使用 Oracle 实体框架适配器并为所有视图创建实体(它是只读服务)。我遇到的问题是 DateTimeOffset 不是受支持的基元类型。
好吧,我用谷歌搜索了一下,这不是一个未知的问题,但我找不到答案!我无法编辑视图来更改作为专有数据库返回的类型。有些人提到使用 RegisterKnownType(typeof(DateTimeOffset)) 但这不起作用。其他人说我需要序列化数据,但没有解释如何序列化。
有没有人有关于如何获取 WCF 数据服务返回的不支持的原始类型的分步解决方案?
I am trying to create a WCF dataservice for an Oracle database. I'm using the Oracle entity framework adapter and creating entities for all the views (its a read only service). The problem that I am encountering is that DateTimeOffset is not a supported primitive type.
OK, I've googled a fair bit and this is not an unknown problem but I can't find an answer! I can't edit the views to change the type returned as its a proprietary database. Some people have mentioned using RegisterKnownType(typeof(DateTimeOffset)) but this doesn't work. Other people have said I need to serialise the data but don't explain how.
Does anyone have a step by step solution as to how to get unsupported primitive types returned by WCF data services?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
类似于 通过 WCF 修复 DateTimeOffset 的最佳解决方法数据服务问题
Similar to Best work around to fix DateTimeOffset over WCF Data Service issue
数据合同已知类型:
本文档以及 KnownTypeAttribute Class 描述了如何添加到已知类型列表中。
开放数据协议示例还提到了 DateTimeOffset 类型。
Fom Data Contract Known Types:
This document as well as KnownTypeAttribute Class describe how to add to the list of known types.
Open Data Protocol by Example also mentions the DateTimeOffset type.