asp.net-web-api – ASP.Net Web API帮助页面:记录复杂类型属性

我有一个post动作接收Person类型的FromBody参数.在HelpPage中,我获得有关Person paramater的信息.是否可以在Person中列出有关属性的信息,并使用 XML文档文件中的文档来获取每个属性的描述?
public class PersonController : ApiController
{
    /// <summary>
    /// Add a person
    /// </summary>
    /// <param name="person">Person to add</param>
    /// <returns></returns>
    [HttpPost]
    public HttpResponseMessage Add([FromBody] Person person)
    {
        // ...

        return Request.CreateResponse(HttpStatusCode.Created);
    }
}

/// <summary>
/// A person
/// </summary>
public class Person
{
    /// <summary>
    /// The name of the person
    /// </summary>
    public String Name { get; set; }

    /// <summary>
    /// The age of the person
    /// </summary>
    public Int32 Age { get; set; }
}

解决方法

目前不支持开箱即用.有一个相关的工作项,它要求为模型上使用的数据注释属性生成帮助页面.您的方案应该在其固定的后续工作: http://aspnetwebstack.codeplex.com/workitem/877

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....