的WebAPI帮助页说明 [英] WebApi Help Page Description
问题描述
什么填充的WebAPI
法的助手页面上的描述和介绍段落?
What populates the Webapi
method's description on the helper page and the introduction paragraph?
推荐答案
根据这个 <一个href=\"http://www.asp.net/web-api/overview/creating-web-apis/creating-api-help-pages\">article您可以使用XML文档注释来创建文档。要启用此功能,打开文件区/ HelpPage / App_Start / HelpPageConfig.cs并取消对以下行:
According to this article you can use XML documentation comments to create the documentation. To enable this feature, open the file Areas/HelpPage/App_Start/HelpPageConfig.cs and uncomment the following line:
config.SetDocumentationProvider(new XmlDocumentationProvider(
HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
现在启用XML文档。在Solution Explorer中,右键单击该项目并选择属性。选择生成的页面。
Now enable XML documentation. In Solution Explorer, right-click the project and select Properties. Select the Build page.
在输出结果,检查XML文档文件。在编辑框中,键入App_Data文件/ XmlDocument.xml。
Under Output, check XML documentation file. In the edit box, type "App_Data/XmlDocument.xml".
添加一些文档注释到控制器的方法。例如:
Add some documentation comments to the controller methods. For example:
/// <summary>
/// Gets some very important data from the server.
/// </summary>
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
/// <summary>
/// Looks up some data by ID.
/// </summary>
/// <param name="id">The ID of the data.</param>
public string Get(int id)
{
return "value";
}
这篇关于的WebAPI帮助页说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!