gpt4 book ai didi

c# - 是否可以公开摘要信息或类似信息以获取有关使用的 WCF 服务的 Intellisense?

转载 作者:太空狗 更新时间:2023-10-29 23:18:32 26 4
gpt4 key购买 nike

我有一个 WCF 服务,其中的方法很像下面这样。现在,我知道 <summary>信息没有暴露,但我怎样才能暴露这些信息,以便消费者在智能感知中获得信息?

/// <summary>
/// Obtains a list of agreements for a given dealer
/// </summary>
/// <param name="query">Object identifying the dealer<see cref="AgreementListRequest"/></param>
/// <returns>Object containing a list of all agreements for the provided dealer<see cref="AgreementListResponse"/></returns>
[OperationContract]
[FaultContract(typeof(DatabaseFault))]
[FaultContract(typeof(ServiceAgentFault))]
AgreementListResponse GetAgreements(AgreementListRequest request);

最佳答案

这些代码注释仅存在于服务器中 - 它们是注释,并且是特定于 .NET 的,因此当您为 WCF 服务创建客户端代理时,它们不会通过网络传输。

我认为只有一种方法可以满足您的需求:如果您控制电线的两端,例如您同时编写服务(服务器)和客户端,您可以将服务和数据契约放入单独的 Contracts 程序集中,然后在服务和客户端代码之间共享该程序集。在这种情况下,您的客户端代码将使用完全相同的文件,因此可以访问代码注释,这些注释将在智能感知中呈现

我偶然发现的第二个选项是 WCFExtras - 一个 Codeplex 项目,它对 WCF 有一些扩展。您可能感兴趣的扩展是将服务器端的 XML 代码注释呈现为 WSDL 中的 xsd:documentation 标记,并在客户端返回到 XML 代码注释(当使用 . NET 客户端)。

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.

关于c# - 是否可以公开摘要信息或类似信息以获取有关使用的 WCF 服务的 Intellisense?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4895535/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com