我有一个接收类型为Person的FromBody参数的Post动作。在HelpPage中,我可以获取有关Person参数的信息。是否可以列出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; }
}