c# - Generate model description in AspNet WebApi help pages -


how generate description model in asp.net web api pages?

example:

enter image description here

as can see example, can generate name, type , additional information. how generate description?

i've tried nothing , i'm out of ideas.

no, that's not true. i've tried adding comments transactiondto class, not work.

/// <summary> /// dto (data transfer object) transaction objects. /// </summary> public class transactiondto {     /// <summary>     /// manager registered transaction.     /// </summary>     public string fromid { get; set; }      /// <summary>     /// receiving manager.     /// </summary>     [required]     public string toid { get; set; }      /// <summary>     /// optional expiration date.     /// </summary>     public datetime? expires { get; set; }      /// <summary>     /// date transaction created.     /// </summary>     public datetime created { get; set; } } 

i have configured helppageconfig.cs use xmldocumentationprovider so:

config.setdocumentationprovider(new xmldocumentationprovider(httpcontext.current.server.mappath("~/app_data/xmldocument.xml"))); 

so how generate these descriptions models?

i think have models in separate project other web api project?

if case, web api project not aware of xml file generated models. need set xml output path both webapi project , models project , combine both xml files in register method of helppageconfig.cs file.

public static void register(httpconfiguration config) {         xmldocument apidoc = new xmldocument();         apidoc.load(httpcontext.current.server.mappath("~/app_data/vonexpy.ad.webapi.orders.xml"));         xmldocument contractsdoc = new xmldocument();         contractsdoc.load(httpcontext.current.server.mappath("~/app_data/vonexpy.ad.contracts.xml"));         if (contractsdoc.documentelement != null && apidoc.documentelement!=null)         {             xmlnodelist nodes = contractsdoc.documentelement.childnodes;             foreach (xmlnode node in nodes)             {                 xmlnode copiednode = apidoc.importnode(node, true);                 apidoc.documentelement.appendchild(copiednode);             }             apidoc.save(httpcontext.current.server.mappath("~/app_data/vonexpy.ad.webapi.orders.xml"));         }         config.setdocumentationprovider(new xmldocumentationprovider(httpcontext.current.server.mappath("~/app_data/vonexpy.ad.webapi.orders.xml")));     ...... } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -