public static bool IsAsymmetricJson(this BehaviorChain chain) { if (chain.ConnegInputNode() == null && chain.ConnegOutputNode() == null) { return(false); } if (chain.ActionOutputType() != null) { var output = chain.ConnegOutputNode(); if (output.SelectedFormatterTypes.Count() != 1) { return(false); } if (output.SelectedFormatterTypes.Single() != typeof(JsonFormatter)) { return(false); } } if (chain.InputType() != null) { var input = chain.ConnegInputNode(); if (!input.AllowHttpFormPosts) { return(false); } if (input.SelectedFormatterTypes.Count() != 1) { return(false); } if (input.SelectedFormatterTypes.Single() != typeof(JsonFormatter)) { return(false); } } return(true); }
// This should not do anything if there are conneg nodes public static void ApplyConneg(this BehaviorChain chain) { var inputType = chain.InputType(); if (chain.ConnegInputNode() == null && inputType != null) { var inputNode = new ConnegInputNode(inputType); var action = chain.FirstCall(); action.AddBefore(inputNode); } var actionOutputType = chain.ActionOutputType(); if (chain.ConnegOutputNode() == null && actionOutputType != null && actionOutputType != typeof(void) && actionOutputType != typeof(HttpStatusCode)) { var outputNode = new ConnegOutputNode(actionOutputType); var action = chain.Last(x => x is ActionCall); action.AddAfter(outputNode); } }
public string Text(BehaviorChain chain) { return(chain.ActionOutputType().Name); }
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell) { var outputType = chain.ActionOutputType(); cell.Append(new LinkTag(outputType.Name, _examplePageUrl + "?model=" + outputType.FullName)); }
public static bool IsAjaxContinuation(BehaviorChain chain) { var outputType = chain.ActionOutputType(); return outputType != null && outputType.CanBeCastTo<AjaxContinuation>(); }
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell) { var outputType = chain.ActionOutputType(); cell.Child(new LinkTag(outputType.Name, _examplePageUrl + "?model=" + outputType.FullName)); }
public string Text(BehaviorChain chain) { return chain.ActionOutputType().Name; }
public static bool IsAjaxContinuation(BehaviorChain chain) { var outputType = chain.ActionOutputType(); return(outputType != null && outputType.CanBeCastTo <AjaxContinuation>()); }