WebAPIãä½æãããã®ã®ããã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ä»æ§ãããã¥ã¡ã³ãåããã®ã£ã¦ã¾ãã¾ãé¢åã ã¨æãã¾ã*1ã
ãããªæã«WebAPIãå ¬éãã¦ãããµã¤ãã«APIã®ãã«ããèªåçæãã¦å ¬éããæ¹æ³ãããã®ã§ç´¹ä»ãã¾ãã
Microsoft.AspNet.WebApi.HelpPageã®ã¤ã³ã¹ãã¼ã«
Microsoft.AspNet.WebApi.HelpPageã¨ããããã±ã¼ã¸ãNuGetã§å ¬éããã¦ãã¾ãã®ã§ãããã¤ã³ã¹ãã¼ã«ãã¾ãã
ããã±ã¼ã¸ããã¼ã¸ã£ã³ã³ã½ã¼ã«ããã¤ã³ã¹ãã¼ã«ããå ´åã¯ä»¥ä¸ã®ã³ãã³ãã§è¡ãã¾ãã
Install-Package Microsoft.AspNet.WebApi.HelpPage
ããã§Webãµã¤ããå®è¡ãã¦ã[ãµã¤ãã®URL]/Helpã«ã¢ã¯ã»ã¹ããã¨ãèªåã§ä»¥ä¸ã®ãããªãã«ããã¼ã¸ãè¦ããã¨ãã§ããããã«ãªã£ã¦ãã¾ãã
ãã ãAPIã®èª¬æããNo documentation available.ãã«ãªã£ã¦ãããã¦ããã«ãã®å½¹å²ãååã«ã¯æããã¦ãã¾ããã
ããã§ã移è¡ã®æé ã§ã¯ã©ã¹ãã¡ã½ããã®ã³ã¡ã³ãããã«ãã«åæ ããããã«ãã¾ãã
HelpPageConfig.csã®ä¿®æ£
\Areas\HelpPage\App_Start\HelpPageConfig.cs ãéããRegisterã¡ã½ããã«ããä¸è¨é¨åã®ã³ã¡ã³ããå¤ãã¾ãã
//// Uncomment the following to use the documentation from XML documentation file. //config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
ããã¸ã§ã¯ãã®è¨å®
ããã¸ã§ã¯ãã®ããããã£ãéãã以ä¸ã®ããã«ãã«ãæã«XMLããã¥ã¡ã³ããã¡ã¤ã«ãåºåããããè¨å®ãã¾ãã
åºåå ã¯HelpPageConfig.csã«æ¸ããã¦ãããã¹ã«åããã¦ããã¾ãã
ã³ã³ããã¼ã©ã®ã³ã¡ã³ã
以ä¸ã®ããã«ã³ã³ããã¼ã©ã¯ã©ã¹ããã®ã¡ã½ããã«ã³ã¡ã³ããæ¸ãã¦ããã¾ãã
ã¡ãªã¿ã«ãã³ã¡ã³ãå ¥ãããç®æã§ã///ãã¨å ¥åãã¦Enterãæ¼ãã¨ã³ã¡ã³ãã®ã²ãªå½¢ãä½æããã¾ãã
/// <summary> /// åä»æã®ééé¡è¨ç®API /// </summary> public class FeeController : ApiController { private MyDbContext db = new MyDbContext(); /// <summary> /// æ¡ä»¶ããééé¡ãè¨ç®ãã /// </summary> /// <param name="id">åå¼·ä¼ID</param> /// <param name="attendSocialGathering">æ親ä¼åå ï¼true/falseï¼</param> /// <param name="isStudent">å¦çï¼true/falseï¼</param> /// <param name="isInstructor">è¬å¸«ï¼true/falseï¼</param> /// <param name="isConcerned">ä¼å ´é¢ä¿è ï¼true/falseï¼</param> /// <param name="isStaff">åå¼·ä¼ã¹ã¿ããï¼true/falseï¼</param> /// <returns></returns> public FeeInfo Get(int id, bool attendSocialGathering, bool isStudent, bool isInstructor, bool isConcerned, bool isStaff) { /// çç¥ }
å®è¡çµæ
å ã»ã©ã®ãã«ããã¼ã¸ãè¦ãã¨ä»¥ä¸ã®ããã«ã³ã¡ã³ãã«æ¸ããå 容ãåæ ããã¦ãã¾ãã
APIã®ãã©ã¡ã¼ã¿ã«ã¤ãã¦ã以ä¸ã®ããã«åæ ããã¦ãã¾ãã
ã¡ãªã¿ã«ãã®ãã«ãã§ããããã¡ããã¬ã¹ãã³ã¹ã®å½¢å¼ãåºåãã¦ããã¾ãããå ãã¦ä¾ãåºåãã¦ããã¾ãã便å©ã§ããã
*1:æ¬æ¥ãªãå ã«ããã¥ã¡ã³ããããã¹ããªã®ããããã¾ãããâ¦