本文整理汇总了C#中ActionCall.ParentChain方法的典型用法代码示例。如果您正苦于以下问题:C# ActionCall.ParentChain方法的具体用法?C# ActionCall.ParentChain怎么用?C# ActionCall.ParentChain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionCall
的用法示例。
在下文中一共展示了ActionCall.ParentChain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSwaggerOperations
public IEnumerable<Operation> GetSwaggerOperations(ActionCall call)
{
var parameters = createParameters(call);
var outputType = call.OutputType();
var route = call.ParentChain().Route;
var verbs = getRouteVerbs(route);
return verbs.Select(verb =>
{
var summary = call.InputType().GetAttribute<DescriptionAttribute>(d => d.Description);
return new Operation
{
parameters = parameters.ToArray(),
httpMethod = verb,
responseTypeInternal = outputType.FullName,
responseClass = outputType.Name,
nickname = call.InputType().Name,
summary = summary,
//TODO not sure how we'd support error responses
errorResponses = new ErrorResponses[0],
//TODO get notes, nickname, summary from metadata?
};
});
}
示例2: Alter
public override void Alter(ActionCall call)
{
var entityType = _entityType ?? call.HandlerType.GetEntityType();
var role = CrudRules.SecurableNameForViewing(entityType);
call.ParentChain().Authorization.AddRole(role);
}
示例3: Attach
public virtual void Attach(IViewProfile viewProfile, ViewBag bag, ActionCall action)
{
// No duplicate views!
var outputNode = action.ParentChain().Output;
if (outputNode.HasView(viewProfile.ConditionType)) return;
var log = new ViewAttachmentLog(viewProfile);
action.Trace(log);
foreach (var filter in _filters)
{
var viewTokens = filter.Apply(action, bag);
var count = viewTokens.Count();
if (count > 0)
{
log.FoundViews(filter, viewTokens.Select(x => x.Resolve()));
}
if (count != 1) continue;
var token = viewTokens.Single().Resolve();
outputNode.AddView(token, viewProfile.ConditionType);
break;
}
}
示例4: Alter
public override void Alter(ActionCall call)
{
var chain = call.ParentChain();
if (_formatters == FormatterOptions.All)
{
chain.Input.AllowHttpFormPosts = true;
chain.UseFormatter<JsonFormatter>();
chain.UseFormatter<XmlFormatter>();
return;
}
if ((_formatters & FormatterOptions.Json) != 0)
{
chain.UseFormatter<JsonFormatter>();
}
if ((_formatters & FormatterOptions.Xml) != 0)
{
chain.UseFormatter<XmlFormatter>();
}
if ((_formatters & FormatterOptions.Html) != 0)
{
chain.Input.AllowHttpFormPosts = true;
}
else
{
chain.Input.AllowHttpFormPosts = false;
}
}
示例5: Alter
public override void Alter(ActionCall call)
{
var chain = call.ParentChain();
var alias = call.BuildRouteForPattern(_pattern);
chain.AddRouteAlias(alias);
}
示例6: Alter
public override void Alter(ActionCall call)
{
var inputType = call.InputType();
Types.Each(attType =>
{
var ruleType = RuleTypeFor(inputType, attType);
call.ParentChain().Authorization.AddPolicy(ruleType);
});
}
示例7: addCreationPermission
private void addCreationPermission(ActionCall action)
{
// If there are no other permissioning, add one
if (!action.HasAttribute<AuthorizationAttribute>())
{
var permissionName = CrudRules.SecurableNameForCreation(_entityType);
action.ParentChain().Authorization.AddRole(permissionName);
}
}
示例8: Alter
public override void Alter(ActionCall call)
{
var token = new WebFormViewToken(ViewType);
call.ParentChain().AddToEnd(token.ToBehavioralNode());
// TODO -- add some tracing back here.
/*
*
graph.Observer.RecordCallStatus(x,
"Action '{0}' has {1} declared, using WebForms view '{2}'".ToFormat(
x.Description, typeof(WebFormsEndpointAttribute).Name, token));
*
*/
}
示例9: Attach
public void Attach(IViewProfile viewProfile, ViewBag bag, ActionCall action)
{
// No duplicate views!
var outputNode = action.ParentChain().Output;
if (outputNode.HasView(viewProfile.Condition)) return;
foreach (var filter in _policy.Filters())
{
var viewTokens = filter.Apply(action, bag);
var count = viewTokens.Count();
if (count != 1) continue;
var token = viewTokens.Single().Resolve();
_attached.Add(token);
outputNode.AddView(token, viewProfile.Condition);
break;
}
}
示例10: Alter
public override void Alter(ActionCall call)
{
var html = call.ParentChain().Output.AddHtml();
html.MoveToFront();
}
示例11: Alter
public override void Alter(ActionCall call)
{
var authorizationNode = call.ParentChain().Authorization;
Types.Each(authorizationNode.Add);
}
示例12: Alter
public override void Alter(ActionCall call)
{
var chain = call.ParentChain();
chain.Tags.Fill(_tags);
}
示例13: IsApiCall
private static bool IsApiCall(ActionCall actionCall)
{
return actionCall.ParentChain().InputType().CanBeCastTo<IApi>();
}
示例14: Configure
public void Configure(ActionCall action, MenuItemAttribute att, NavigationGraph graph)
{
var registrations = att.ToMenuRegistrations(action.ParentChain());
graph.AddRegistrations(registrations);
}
示例15: Alter
public override void Alter(ActionCall call)
{
var chain = call.ParentChain();
Alter(chain);
}