本文整理汇总了C#中FubuMVC.Core.Registration.Routes.RouteDefinition.ApplyInputType方法的典型用法代码示例。如果您正苦于以下问题:C# RouteDefinition.ApplyInputType方法的具体用法?C# RouteDefinition.ApplyInputType怎么用?C# RouteDefinition.ApplyInputType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FubuMVC.Core.Registration.Routes.RouteDefinition
的用法示例。
在下文中一共展示了RouteDefinition.ApplyInputType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBasicRouteInputs
public static void AddBasicRouteInputs(ActionCall call, RouteDefinition route)
{
call.InputType()
.GetProperties()
.Where(x => x.HasAttribute<RouteInputAttribute>())
.Each(prop => route.Append("{" + prop.Name + "}"));
route.ApplyInputType(call.InputType());
}
示例2: Build
public IRouteDefinition Build(ActionCall call)
{
Type viewModelType = call.HandlerType.GetGenericArguments()[0];
var route = new RouteDefinition(viewModelType.Name.Replace("ViewModel","").ToLower());
route.ApplyInputType(viewModelType);
route.AddHttpMethodConstraint("POST");
return route;
}
示例3: Build
public IRouteDefinition Build(ActionCall call)
{
// Later on we need to put in real plural naming.
string pattern = call.HandlerType.GetGenericArguments()[0].Name.Replace("ViewModel", "") + "es";
var route = new RouteDefinition(pattern.ToLower());
route.ApplyInputType(call.InputType());
route.AddHttpMethodConstraint("GET");
return route;
}
示例4: sets_the_full_url
public void sets_the_full_url()
{
var fullUrl = "this/is/a/test";
var route = new RouteDefinition("blah");
route.ApplyInputType(typeof(object));
theChain.Route = route;
theUrlResolver.Stub(x => x.UrlFor(theInput, theChain)).Return(fullUrl);
theResolver.Stub(x => x.Find(theSearch)).Return(theChain);
theRequest.Attach(theServices);
theRequest.Url.ShouldEqual(fullUrl);
}
示例5: Build
public IRouteDefinition Build(ActionCall call)
{
string pattern = call.HandlerType.GetGenericArguments()[0].Name.Replace("ViewModel", "");
var route = new RouteDefinition(pattern.ToLower());
route.Append("{Id}");
if (call.InputType().Name.StartsWith("Edit`"))
{
route.Append("edit");
}
else if (call.InputType().Name.StartsWith("Get`"))
{
route.Append("view");
}
route.ApplyInputType(call.InputType());
route.AddHttpMethodConstraint("GET");
return route;
}