本文整理汇总了C#中ActionCall.BuildRouteForPattern方法的典型用法代码示例。如果您正苦于以下问题:C# ActionCall.BuildRouteForPattern方法的具体用法?C# ActionCall.BuildRouteForPattern怎么用?C# ActionCall.BuildRouteForPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionCall
的用法示例。
在下文中一共展示了ActionCall.BuildRouteForPattern方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Alter
public override void Alter(ActionCall call)
{
var chain = call.ParentChain();
var alias = call.BuildRouteForPattern(_pattern);
chain.AddRouteAlias(alias);
}
示例2: Build
public IRouteDefinition Build(ActionCall call)
{
var pattern = call.Method.GetAttribute<UrlPatternAttribute>().Pattern;
var route = call.BuildRouteForPattern(pattern);
return route;
}
示例3: Build
public IRouteDefinition Build(ActionCall call)
{
var pattern = call.Method.GetAttribute<UrlPatternAttribute>().Pattern;
var route = call.BuildRouteForPattern(pattern);
route.Trace("Action '{0}' has the [{1}] defined. Using explicitly defined URL pattern.", call.Method.Name,
typeof (UrlPatternAttribute).Name);
return route;
}
示例4: modifyEditAction
private void modifyEditAction(ActionCall action)
{
// At least one Crud controller 'ignores' its Edit method
if (action == null) return;
var chain = action.ParentChain();
chain.Route = action.BuildRouteForPattern("{0}/{{Id}}".ToFormat(_routeName));
// If there are no
if (!action.HasAttribute<AuthorizationAttribute>())
{
var permissionName = CrudRules.SecurableNameForViewing(_entityType);
chain.Authorization.AddRole(permissionName);
}
// apply data restrictions
var policyType = typeof(RestrictedDataAuthorizationPolicy<>).MakeGenericType(_entityType);
chain.Authorization.AddPolicy(policyType);
action.AddAfter(Wrapper.For<CrudUrlBehavior>());
}