Including XML Comments in DataContract Serializer Metadata

左心房为你撑大大i 提交于 2019-12-07 03:13:05

问题


is there some way of sending the summary info of properties in a DataContract?

e.g.

[DataContract]
public class MyClass
{
  /// <summary>
  /// My Summary information
  /// </summary>
  [DataMember]
  public int MyProperty {get;set;}
}

can this be available to the client that gets the datacontract? I doubt it, just hoping somebody knows something I don't, which is quite likely. :)


回答1:


Take a look at WCFExtras on CodePlex. I haven't used it, but it sounds like it does exactly what you want:

Adding WSDL Documentation from Source Code XML Comments

This extension allows you to add WSDL documentation (annotaiton) directly from XML comments in your source file. These comments will be published as part of the WSDL and are available for WSDL tools that know how to take advantage of them (e.g. Apache Axis wsdl2java and others). Release 2.0 also includes a client side WSDL importer that will turn those WSDL comments to XML comments in the generated proxy code.




回答2:


If you're referring to the XML comments, then no, they cannot be sent. There is noplace within a WSDL in which they could be sent in such a way that a client could use them.



来源:https://stackoverflow.com/questions/3198911/including-xml-comments-in-datacontract-serializer-metadata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!