简体   繁体   English

如何在使用XSD.exe生成的C#类中包含xsd:documentation?

[英]How to include the xsd:documentation in the C# class generated with XSD.exe?

I am using xsd.exe to generate a C# class from a collection of xsd files. 我正在使用xsd.exe从xsd文件集合生成C#类。 The xsd file makes use of the <xsd:documentation> tag to include useful descriptions. xsd文件使用<xsd:documentation>标记来包含有用的描述。 Example: 例:

<xsd:complexType name="AddressType">
    <xsd:annotation>
        <xsd:documentation>A formatted or free form address and its intended use.</xsd:documentation>
    </xsd:annotation>

Unfortunately all of this is lost in the generated C# class. 不幸的是,所有这些都在生成的C#类中丢失了。 Interestingly each class has an empty remarks documentation tag attached to it. 有趣的是,每个类都附有一个空的备注文档标记。

/// <remarks/>

How can I include this documentation in the generated C# class (either in or documentation tags)? 如何在生成的C#类中包含此文档(在文档标签中)?

xsd.exe is based on Codedom. xsd.exe基于Codedom。

You could disassemble xsd.exe, and add the functionality there and recompile. 您可以反汇编xsd.exe,并在那里添加功能并重新编译。 The code is reasonably simple. 代码相当简单。

I had modified it to skip some namespaces from xsd while generating code.[Otherwise If I include a common.xsd in 2 other xsds the class was getting generated twice.] 我已经修改它以在生成代码时从xsd跳过一些命名空间。[否则如果我在其他2个xsds中包含common.xsd,则该类生成两次。]

Granted, I had access to source proper itself [I was a developer at Microsoft], but the process should be simple with diassembled code as well. 当然,我可以自己访问源代码[我是Microsoft的开发人员],但是使用反汇编代码的过程应该很简单。

对不起,没办法做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM