public IEnumerable<IHttpRoute> Build(RouteBuilderInfo builderHelper) { var route = builderHelper.CreateRoute(GenerateRouteTemplate(builderHelper)); builderHelper.ActionCall.SetParamsDefaults(route.Defaults); foreach (var arg in builderHelper.ActionCall.GetArgumentNames()) { IHttpRouteConstraint constraint = GetConstraint(builderHelper, arg); if (constraint != null) { route.Constraints[arg] = constraint; } } MethodInfo action = builderHelper.ActionCall.Method; if (action.Name.StartsWith("Get") || action.Name.StartsWith("Find") || action.GetCustomAttribute<HttpGetAttribute>() != null) { route.ConstrainToGet(); } if (action.Name.StartsWith("Post") || action.GetCustomAttribute<HttpPostAttribute>() != null) { route.ConstrainToPost(); } return new[] { route }; }
public IEnumerable <IHttpRoute> Build(RouteBuilderInfo builderHelper) { var route = builderHelper.CreateRoute(GenerateRouteTemplate(builderHelper)); builderHelper.ActionCall.SetParamsDefaults(route.Defaults); foreach (var arg in builderHelper.ActionCall.GetArgumentNames()) { IHttpRouteConstraint constraint = GetConstraint(builderHelper, arg); if (constraint != null) { route.Constraints[arg] = constraint; } } MethodInfo action = builderHelper.ActionCall.Method; if (action.Name.StartsWith("Get") || action.Name.StartsWith("Find") || action.GetCustomAttribute <HttpGetAttribute>() != null) { route.ConstrainToGet(); } if (action.Name.StartsWith("Post") || action.GetCustomAttribute <HttpPostAttribute>() != null) { route.ConstrainToPost(); } return(new[] { route }); }
public virtual IEnumerable <Route> Build(RouteBuilderInfo info) #endif { var modelInfo = new ModelInfo(info.ActionCall, CanBeRouteParameter); var route = info.CreateRoute(BuildUrlTemplate(modelInfo)); if (!IsCommand(info.ActionCall)) { modelInfo.Members.ForEach(m => { SetDefaultValue(m, modelInfo.Instance, route.Defaults); SetConstraint(m, info, route.Constraints); }); } if (!IsCommand(info.ActionCall)) { route.ConstrainToGet(); } if (info.ActionCall.IsPost()) { route.ConstrainToPost(); } SetConstraints(info, route.Constraints); return(new[] { route }); }
public IEnumerable<Route> Build(RouteBuilderInfo info) { var url = info.ActionCall.Controller.ToWebsiteRelativePath(info.ActionCall.Controller.Assembly).ToLower(); url = url.TrimStart('~', '/'); var route = info.CreateRoute(url); route.DataTokens["Namespaces"] = new[] { info.ActionCall.Controller.Namespace }; return new[] { route }; }
public IEnumerable <Route> Build(RouteBuilderInfo info) { var url = info.ActionCall.Controller.ToWebsiteRelativePath(info.ActionCall.Controller.Assembly).ToLower(); url = url.TrimStart('~', '/'); var route = info.CreateRoute(url); route.DataTokens["Namespaces"] = new[] { info.ActionCall.Controller.Namespace }; return(new[] { route }); }
Route MakeDefaultRoute() { var info = new RouteBuilderInfo(_action, _parent); var route = info.CreateRoute(DefaultRouteUrl); if (_isModelInput) { FillModelParamValues(route.Defaults); } else { FillParamValues(route.Defaults); } route.ConstrainToGet(); return(route); }
public virtual IEnumerable<Route> Build(RouteBuilderInfo info) #endif { var modelInfo=new ModelInfo(info.ActionCall,CanBeRouteParameter); var route = info.CreateRoute(BuildUrlTemplate(modelInfo)); if (!IsCommand(info.ActionCall)) { modelInfo.Members.ForEach(m => { SetDefaultValue(m, modelInfo.Instance, route.Defaults); SetConstraint(m, info, route.Constraints); }); } if (!IsCommand(info.ActionCall)) route.ConstrainToGet(); if (info.ActionCall.IsPost()) route.ConstrainToPost(); SetConstraints(info,route.Constraints); return new[] { route }; }