/// <summary> /// 绑定路由 /// </summary> /// <param name="config"></param> public static void Bind(HttpConfiguration config) { var entryRoute = new ApiContractRoute(); //entryRoute.ExpiresTime = 10000; //entryRoute.IsBind = true; entryRoute.OnDecryptParameter = QueryDecryptParameter; //用户信息接口 entryRoute.Bind <UserInfoController>() .With <LoginQueryContract>() .With <QueryUserInfoByIdContract>(); config.Routes.Add("singleEntryRoute", entryRoute); }
public static void Register(HttpConfiguration config) { // Web API 配置和服务 // Web API 路由 config.MapHttpAttributeRoutes(); //绑定服务 var entryRoute = new ApiContractRoute(true); //用户信息接口 entryRoute.Bind <UserInfoController>() .With <LoginQueryContract>(); config.Routes.Add("singleEntryRoute", entryRoute); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }