News
December 06 2014: Version 1.0.0.8
Add Register RouteConfiguration
iis 7 Integrated Mode:
iis 6
Register Service and Route on Global.asax
protected void Application_Start(object sender, EventArgs e) { FdRouteTable.RegisterService("FdServiceTest"); FdRouteTable.RegisterRoute( name: "Default", url: "api/{controller}/{action}" ); }
Usage
API Statement:
[FdService(SessionMode = SessionMode.Support, IsPublicAllMethod = true)][Auth(Message="Login Authorization")]public class SchoolApi{ [FdMethod] [Auth(Order = 1, Message = "Authorization")] [log(Order = 2, Message = "Log Record")] public static int GetPointsByID(int id) { return 10; } [FdMethod(ResponseFormat = ResponseFormat.Json)] public static ListGetStudentList() { return new List () { new Student() { Age = 13, Name = "LOKI" }, new Student() { Age = 14, Name = "Frigga" } }; }}
Client invoke:
$.get("/api/SchoolApi/GetPointsByID/", { sid: 101, id: 100 }, function (data) { $("#textDetail").append("GetPointsByID:" + data); });
Installation
FD.Service can be installed via the nuget UI (as ), or via the nuget package manager console:
PM> Install-Package FD.Service
开源地址: