我对所有 api 响应都使用了通用返回类型:
public HttpStatusCode statusCode { get; set; }
public string error { get; set; }
public IDictionary<string, string> errorfor { get; set; }
public T result { get; set; }
在 API 中:
/// <summary>
/// GET Order API
/// </summary>
/// <returns> return list of orders {Order} </returns>
public HttpResponseMessage Get(){
var response = new BaseResponseMessage<IList<Order>>();
//some more codes
response.result = orders;
return Request.CreateResponse(HttpStatusCode.OK, response);
}
现在,我的 API 帮助页面当然不会在示例响应正文中显示订单。是否可以配置帮助页面生成器以显示通用类型?谢谢!