基于ApplicationSpecific为自定义类生成XSD

编程入门 行业动态 更新时间:2024-10-25 02:22:17
本文介绍了基于ApplicationSpecific为自定义类生成XSD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

尝试使用xsd.exe为我们创建的类生成xsd时出现故障。从仅包含已剥离的测试类的dll生成仍然返回"Microsoft.Health.HealthRecordItemKey无法序列化,因为它不具有无参数构造函数的。"所以它似乎是ApplicationSpecific继承的基础,尽管我们的类和ApplicationSpecific都有无参数构造函数。

我们有很多开发经验,只是在构建复杂的HealthVault时没有太多 - 基于类,所以解决方案可以是"noob"。这个特定领域的错误。

您是否看到并解决了这个问题?

感激不尽的任何指导。

谢谢。

PS我们已经阅读了Eric G关于课堂建设的帖子,所以任何 的回复都指出我们没有太多的帮助。

解决方案

嗨Dramacrat,

我不熟悉xsd.exe工具,所以我对它的原因无能为力,但是什么(报告的错误)几乎都说明了。

ApplicationSpecific类派生自HealthRecordItem,它具有HealthRecordItemKey类型的私有成员,实际上并没有定义无参数构造函数。如果你有SDK源可以创建SDK的私有版本,并修改有问题的类,允许该工具运行。我不认为这样的改变会影响输出,使其无法使用。

-Sean

Hi,

We get a failure when trying to use xsd.exe to generate an xsd for a class we have created. Generating from a dll containing only a stripped down test class still returns "Microsoft.Health.HealthRecordItemKey cannot be serialized because it does not have a parameterless constructor." so it seems to be fundamental to the inheritance of ApplicationSpecific even though both our class and ApplicationSpecific do have parameterless constructors.

We have loads of dev experience, just not a lot in building complex HealthVault-based classes so the solution could be a "noob" error in this specific area.

Have you seen and overcome this problem?

Any guidance gratefully received.

Thanks.

P.S. We have read Eric G's posts on class construction so any responses that only point us there won't be a lot of help.

解决方案

Hi Dramacrat,

I am not familiar with the xsd.exe tool, so I can't help much with the why, but the what( the error being reported ) pretty much says it all.

The ApplicationSpecific class derives from HealthRecordItem which has a private member of type HealthRecordItemKey that, in fact does not define a parameterless constructor. If you have the SDK source could create a private build of the SDK, and modify the class in question, allowing the tool to run. I would not think that such a change would impact the output so much as to make it unusable.

-Sean

更多推荐

基于ApplicationSpecific为自定义类生成XSD

本文发布于:2023-11-09 05:30:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571510.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   ApplicationSpecific   XSD

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!