[Original Open Source]. Net Api open interface documentation website,. netapi
Open Source Address: http://git.oschina.net/chejiangyi/ApiView
Open source QQ group:. net open source basic service 238543768
ApiView
The. net api interface document is used to view websites and solve Api interface management and communication problems during distributed development.
-Automatically generate api documentation;
-Facilitates api debugging and connection with third-party developers. It can be used in asp.net mvc, wcf, and webservice;
-The code and principles are simple and convenient for secondary development and improvement.
Installation Package
You can directly install and use git to download the project and open the \ installation package \ directory.
Demo
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.Mvc;
6 using BSF.BaseService.OpenApi.Attributes;
7 using BSF.Extensions;
8 using BSF.Api;
9
10 namespace ApiViewTestWeb.Controllers
11 {
12 public class DemoController: Controller
13 {
14 //
15 // GET: / Demo /
16
17 [OpenDoc ("Index", "test method", "Parameter description", "Result description", "Result status description", "Author", 1.0,1.0, "Remarks")]
18 public string Index (int a, string b, float d)
19 {
20 return a + b.NullToEmpty () + d;
twenty one }
twenty two
23 [OpenDoc ("Product list V15 of a certain store", "Product list V15 of a certain store",
24 @ "token: token (optional parameter),
25 Merchant account: shopid,
26 category id: categoryid int ?,
27 Keywords: keyword,
28 barcode: barcode,
29 display counts: pageSize,
30 page number: pageIndex ",
31 @ "Event serial number (Int): hdxh,
32 product barcode (string): sptm,
33 product name (string): spmc,
34 specifications (string): ggxh,
35 unit of measure (string): jldw,
36 product images (string): sptp,
37 Picture modification time (string): sptpxgsj,
38 original retail price (Decimal): original_lsj,
39 Retail Price (Decimal): lsj,
40 product sales (Decimal): spxl,
41 Whether the activity product (int): isActivity,
42 total number of events (Decimal): hdzsl,
43 Decimal per person: mrxgsl,
44 "," -5 missing parameters "," Che Jiangyi ", 1.5, 1.5," ")]
45 public ActionResult List (string shopid, int? Categoryid, string keyword, string barcode, long? PageSize, long? PageIndex)
46 {
47 return Json (new ServiceResult () {code = 1, data = "test data", msg = "success", total = 1});
48}
49}
50}
1. Reference BSF. dll and BSF. BaseService. OpenApi. dll
2. Add the OpenDocAttribute feature annotation in the interface method under the Controller of the MVC website.
3. See DemoController in ApiViewTestWeb usage.
4. Publish OpenApi information on the AppView site.
Configure web. config in AppView as follows:
<! -- Multiple Api documents can be configured with multiple dllpaths, such as DllPath1 and DllPath2;
Interface dll path api assembly path, multiple; separated format: dll path of the interface to be exposed; Interface Name; test appurl' -->
<Add key = "DllPath1" value = "D: \ svn-working \ RT_Cloud \ trunk \ source code \ BaseService \ ApiView \ ApiViewTestWeb \ bin \ ApiViewTestWeb. dll; ApiViewTestWeb [Example]; http: // 10.17.72.96: 8081/"/>
5. Click the "reload" button in the "Help document" of the AppView site to take effect.
Part
By che jiangyi