本文整理汇总了C#中BehaviorChain.FirstCall方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorChain.FirstCall方法的具体用法?C# BehaviorChain.FirstCall怎么用?C# BehaviorChain.FirstCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BehaviorChain
的用法示例。
在下文中一共展示了BehaviorChain.FirstCall方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Matches
public bool Matches(BehaviorChain chain)
{
var call = chain.FirstCall();
if (call == null) return true;
return !call.HasAttribute<NotValidatedAttribute>() && !call.InputType().HasAttribute<NotValidatedAttribute>();
}
示例2: Modify
public static void Modify(BehaviorChain chain)
{
// Not everything is hard
chain.Output.Remove();
if (chain.OfType<InputNode>().Any())
{
chain.Input.AddAfter(chain.Output);
}
else
{
chain.FirstCall().AddBefore(chain.Output);
}
}
示例3: attachMediaHandling
private void attachMediaHandling(BehaviorChain chain, IConfigurationObserver observer)
{
var firstAction = chain.FirstCall();
if (firstAction == null) return;
observer.RecordCallStatus(firstAction, "Meets criteria {0} for Conneg".ToFormat(_description));
var node = new ConnegNode(){
InputType = chain.InputType(),
OutputType = chain.Calls.Where(x => x.HasOutput).Select(x => x.OutputType()).LastOrDefault()
};
firstAction.AddBefore(node);
}
示例4: VisitRoute
public void VisitRoute(IRouteDefinition route, BehaviorChain chain)
{
ActionCall action = chain.FirstCall();
if (action == null) return;
if (action.HasInput)
{
// TODO: throw if route is null;
var model = (IModelUrl) route;
_registration.AddModel(model);
}
var actionUrl = new ActionUrl(route, action);
_registration.AddAction(actionUrl);
}
示例5: ModeFor
public FormMode ModeFor(BehaviorChain chain)
{
var call = chain.FirstCall();
if (call == null || call.HasAttribute<NoFormModeAttribute>())
{
return FormMode.None;
}
if (call.HasInput && call.InputType().HasAttribute<NoFormModeAttribute>())
{
return FormMode.None;
}
var policy = policyFor(chain) ?? FormModePolicy.Default();
return policy.ModeFor(chain);
}
示例6: GetQuerystringParameters
private List<QuerystringParameter> GetQuerystringParameters(BehaviorChain chain)
{
var action = chain.FirstCall();
return _typeCache.GetPropertiesFor(action.InputType())
.Where(x => x.Value.IsQuerystring(action) &&
!x.Value.HasAttribute<HideAttribute>() &&
!x.Value.IsAutoBound())
.Select(x => {
var description = _memberConvention.GetDescription(x.Value);
return _configuration.QuerystringOverrides.Apply(chain, x.Value, new QuerystringParameter {
Name = description.WhenNotNull(y => y.Name).OtherwiseDefault(),
Comments = description.WhenNotNull(y => y.Comments).OtherwiseDefault(),
Type = (x.Value.PropertyType.GetListElementType() ?? x.Value.PropertyType).GetXmlName(_configuration.EnumFormat == EnumFormat.AsString),
Options = _optionFactory.BuildOptions(x.Value.PropertyType),
DefaultValue = description.DefaultValue.WhenNotNull(y => y.ToSampleValueString(_configuration)).OtherwiseDefault(),
MultipleAllowed = x.Value.PropertyType.IsArray || x.Value.PropertyType.IsList(),
Required = !description.Optional
});
}).OrderBy(x => x.Name).ToList();
}
示例7: GetUrlParameters
private List<UrlParameter> GetUrlParameters(BehaviorChain chain)
{
var action = chain.FirstCall();
var properties = _typeCache.GetPropertiesFor(action.InputType());
return action.ParentChain().Route.Input.RouteParameters.Select(
x => {
var property = properties[x.Name];
var description = _memberConvention.GetDescription(property);
return _configuration.UrlParameterOverrides.Apply(chain, property, new UrlParameter {
Name = description.WhenNotNull(y => y.Name).OtherwiseDefault(),
Comments = description.WhenNotNull(y => y.Comments).OtherwiseDefault(),
Type = property.PropertyType.GetXmlName(_configuration.EnumFormat == EnumFormat.AsString),
Options = _optionFactory.BuildOptions(property.PropertyType)
});
}).ToList();
}
示例8: GetRequest
private Data GetRequest(BehaviorChain chain, EndpointDescription endpoint)
{
var firstCall = chain.FirstCall();
DataType type = null;
List<BodyLineItem> description = null;
if (firstCall.HasInput &&
!chain.Route.AllowsGet() &&
!chain.Route.AllowsDelete())
{
type = _typeGraphFactory.BuildGraph(firstCall.InputType(), chain.FirstCall());
description = _bodyDescriptionFactory.Create(type);
}
return _configuration.RequestOverrides.Apply(chain, new Data
{
Comments = endpoint.RequestComments,
Headers = GetHeaders(chain, HttpDirection.Request),
MimeTypes = GetMimeTypes(chain, HttpDirection.Request),
Body = new Body { Type = type, Description = description }
});
}
示例9: IsNotFubuChain
static bool IsNotFubuChain(BehaviorChain chain)
{
var call = chain.FirstCall();
if (call == null) return false;
return call.HandlerType.Assembly != typeof (FubuRegistry).Assembly;
}
示例10: IsNotSwankChain
static bool IsNotSwankChain(BehaviorChain chain)
{
var call = chain.FirstCall();
if (call == null) return false;
return call.HandlerType.Assembly != typeof(BehaviorSource).Assembly;
}
示例11: IsNotConfigThing
bool IsNotConfigThing(BehaviorChain chain)
{
return (!_configuration.AppliesToAssemblies.Any() ||
_configuration.AppliesToAssemblies.Any(y => y == chain.FirstCall().HandlerType.Assembly));
}