相关疑难解决方法(0)

Web Api帮助页面 - 所有<see cref ="MyClass"/>都缺失

在我的源代码文档中,我经常使用:

Get a <see cref="Quote"/> for the specified <see cref="apiOrder"/> object.
Run Code Online (Sandbox Code Playgroud)

这很好地转换为XmlDocument.xml中的下面的字符串,其中包含已编译的web api帮助页面.

Get a <see cref="T:Supertext.API.POCO.Quote"/> for the specified <see cref="!:apiOrder"/> object.
Run Code Online (Sandbox Code Playgroud)

但由于某些原因,所有这些引用都没有显示出来.我们得到的是:

Get a  for the specified  object
Run Code Online (Sandbox Code Playgroud)

我们找到了一些来源,但似乎没有任何效果.没有帮助:
Web Api帮助页面 - 不要在xml文档中转义html

过时的:http:
//thesoftwaredudeblog.wordpress.com/2014/01/04/using-microsoft-asp-net-web-api-2-help-page-part-2/

有任何想法吗?

asp.net-web-api asp.net-web-api-helppages

7
推荐指数
1
解决办法
714
查看次数

如何制作ASP.NET WEB API帮助页面Xml文档注释有新行

我有一个使用ASP.NET WEB API开发的rest api.我使用了帮助页面nuget包来创建文档.我遇到的一个问题是以下问题.对于我的模型对象,我有xml文档注释,它们成为模型中每个成员的帮助页面上的描述.我希望描述的某些部分在新行上,但注释中的所有内容都是一个段落.我试图添加<br/>评论,但没有帮助.有谁知道如何实现这一目标?

xml-documentation asp.net-web-api asp.net-web-api-helppages

5
推荐指数
1
解决办法
1749
查看次数

WebAPI帮助页面-返回或参数模型/类属性的文档

我正在将Web API帮助页面与Web API 2(5.0)一起使用-均为最新的Nuget软件包。我希望帮助文档在HttpResponseMessage的正文中显示作为参数或返回的类的属性的注释。

例如,我有一个像这样的控制器方法:

public HttpResponseMessage Post([FromBody] MyClassType1 myClass)
{
    // Business logic removed for clarity
    return Request.CreateResponse(HttpStatusCode.OK, new MyClassType2());
}
Run Code Online (Sandbox Code Playgroud)

我想要上面发布操作的XML注释,MyClassType1并将MyClassType2其显示在帮助页面上。

我看过的所有地方,到目前为止似乎还不支持。但是,我想知道是否有人能够通过扩展ApiExplorer,添加到XmlDocumentationProvider等使它正常工作?

我知道注释和属性包含在生成的XML文件中,因此我可以尝试手动解析(所有参数和返回类型都在MyAssemblyName.Models名称空间中,因此我想我可以查找具有但是,我知道内置的Web API帮助页面具有某些缓存功能,因此,我宁愿以某种方式将其与现有功能合并(只需对其进行添加)。

通过将Parameters.cshtml模板更新为以下内容,我设法显示了参数的类型(仅向下一层):

@using System.Reflection
@using System.Threading
@using System.Web.Http.Description
@using Regency.API.Services.Areas.HelpPage
@model System.Collections.ObjectModel.Collection<ApiParameterDescription>

<table class="help-page-table">
    <thead>
        <tr><th>Name</th><th>Properties</th><th>Description</th><th>Additional information</th></tr>
    </thead>
    <tbody>
        @foreach (ApiParameterDescription parameter in Model)
        {
            string parameterDocumentation = parameter.Documentation ?? "No documentation available.";
            Type parameterType = parameter.ParameterDescriptor.ParameterType;

            // Don't show CancellationToken because it's a special parameter
            if (!typeof (CancellationToken).IsAssignableFrom(parameter.ParameterDescriptor.ParameterType)) …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc asp.net-web-api asp.net-mvc-apiexplorer asp.net-web-api-helppages

4
推荐指数
1
解决办法
5628
查看次数