本文整理汇总了C#中ActionCall.OutputType方法的典型用法代码示例。如果您正苦于以下问题:C# ActionCall.OutputType方法的具体用法?C# ActionCall.OutputType怎么用?C# ActionCall.OutputType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionCall
的用法示例。
在下文中一共展示了ActionCall.OutputType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: append_json
public void append_json()
{
action = ActionCall.For<ControllerTarget>(x => x.OneInOneOut(null));
action.AddToEnd(new RenderJsonNode(action.OutputType()));
action.Next.ShouldBeOfType<RenderJsonNode>().ModelType.ShouldEqual(action.OutputType());
}
示例2: Apply
public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
{
if(call.OutputType() == typeof(FubuContinuation) || !_policyResolver.HasMatchFor(call))
{
return new IViewToken[0];
}
string viewName = _policyResolver.ResolveViewName(call);
string viewLocatorName = _policyResolver.ResolveViewLocator(call);
IEnumerable<SparkViewToken> allViewTokens =
views.Views.Where(view =>
view.GetType().CanBeCastTo<SparkViewToken>()).Cast<SparkViewToken>();
SparkViewDescriptor matchedDescriptor = null;
allViewTokens.FirstOrDefault(
token =>
{
matchedDescriptor = token.Descriptors
.Where(e => e.Templates
.Any(template => template.Contains(viewLocatorName) && template.Contains(viewName)))
.SingleOrDefault();
return matchedDescriptor != null;
});
IEnumerable<IViewToken> viewsBoundToActions =
matchedDescriptor != null
? new IViewToken[] { new SparkViewToken(call, matchedDescriptor, viewLocatorName, viewName) }
: new IViewToken[0];
return viewsBoundToActions;
}
示例3: Find
public IViewToken Find(ActionCall call, ViewBag views)
{
return views
.ViewsFor(call.OutputType())
.Select(view => view.ToViewToken())
.FirstOrDefault();
}
示例4: IsRedirectable
public static bool IsRedirectable(ActionCall action)
{
var outputType = action.OutputType();
if (outputType == null) return false;
return outputType.CanBeCastTo<FubuContinuation>() || outputType.CanBeCastTo<IRedirectable>();
}
示例5: Apply
public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
{
if(call.OutputType() == typeof(FubuContinuation) || !_policyResolver.HasMatchFor(call))
{
return new IViewToken[0];
}
var viewName = _policyResolver.ResolveViewName(call);
var viewLocatorName = _policyResolver.ResolveViewLocator(call);
var allViewTokens = views
.Views
.Where(view => view.GetType().CanBeCastTo<SparkViewToken>())
.Cast<SparkViewToken>();
SparkViewDescriptor matchedDescriptor = null;
foreach(var token in allViewTokens)
{
var view = viewName.RemoveSuffix(".spark");
var templatePath = !string.IsNullOrEmpty(viewLocatorName) ? "{0}\\{1}".ToFormat(viewLocatorName, view) : view;
var descriptor = token
.Descriptors
.FirstOrDefault(d => d.Templates.Any(template => template.RemoveSuffix(".spark").Equals(templatePath)));
if(descriptor != null)
{
matchedDescriptor = descriptor;
break;
}
}
return matchedDescriptor != null
? new IViewToken[] { new SparkViewToken(call, matchedDescriptor, viewLocatorName, viewName) }
: new IViewToken[0];
}
示例6: 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?
};
});
}
示例7: Find
public IViewToken Find(ActionCall call, ViewBag views)
{
return
views
.ViewsFor(call.OutputType())
.Where(view => view.ViewType.Namespace == call.HandlerType.Namespace)
.FirstOrDefault();
}
示例8: Matches
public bool Matches(ActionCall call, IConfigurationObserver log)
{
if (log.IsRecording)
{
log.RecordCallStatus(call, "This route will have /special in front of it");
}
//Use FubuCore.TypeExtensions to aid the readability of your conventions
//by using .CanBeCastTo<>() and other helper methods to match against types
return call.HasOutput && call.OutputType().CanBeCastTo<string>();
}
示例9: ActionToken
public ActionToken(ActionCall call)
{
MethodName = call.Method.Name;
HandlerType = new TypeToken(call.HandlerType);
if (call.HasInput)
{
InputType = new TypeToken(call.InputType());
}
if (call.HasOutput)
{
OutputType = new TypeToken(call.OutputType());
}
}
示例10: Apply
public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
{
return views.ViewsFor(call.OutputType()).Where(view => view.Name == call.Method.Name && view.Folder == call.HandlerType.Namespace);
}
示例11: Apply
public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
{
return views.ViewsFor(call.OutputType());
}
示例12: addNewEntityPipeline
private void addNewEntityPipeline(ActionCall action)
{
var lastAction = action;
if (action.OutputType() == _entityType)
{
var handlerType = action.HandlerType;
var editMethod = handlerType.GetMethod("Edit");
var editPass = new ActionCall(handlerType, editMethod);
action.AddAfter(editPass);
lastAction = editPass;
}
lastAction.AddAfter(Wrapper.For<CrudUrlBehavior>());
}
示例13: Find
public IEnumerable<IViewToken> Find(ActionCall call, ViewBag views)
{
return
views.ViewsFor(call.OutputType()).Where(view => { return view.Namespace == call.HandlerType.Namespace; });
}
示例14: Matches
public bool Matches(ActionCall call)
{
return call.HandlerType.Name.EndsWith("Controller") && (!call.HasOutput || !call.OutputType().Equals(typeof(JsonResponse)));
}