当前位置: 首页>>代码示例>>C#>>正文


C# BehaviorChain.ResourceType方法代码示例

本文整理汇总了C#中BehaviorChain.ResourceType方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorChain.ResourceType方法的具体用法?C# BehaviorChain.ResourceType怎么用?C# BehaviorChain.ResourceType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BehaviorChain的用法示例。


在下文中一共展示了BehaviorChain.ResourceType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldApply

        public static bool ShouldApply(BehaviorChain chain)
        {
            // TODO -- Get the BehaviorChainFilter thing going again?
            if ( (chain.GetRoutePattern() ?? string.Empty).Contains(DiagnosticUrlPolicy.DIAGNOSTICS_URL_ROOT) )
            {
                return false;
            }            

            if (chain.Calls.Any(x => x.HandlerType.Assembly == DiagnosticAssembly))
            {
                return false;
            }

            if (chain.Calls.Any(x => x.HasAttribute<NoDiagnosticsAttribute>()))
            {
                return false;
            }

            if (chain.InputType() != null && chain.InputType().Assembly == DiagnosticAssembly)
            {
                return false;
            }

            if (chain.ResourceType() != null && chain.ResourceType().Assembly == DiagnosticAssembly)
            {
                return false;
            }

            return true;
        }
开发者ID:JordanZaerr,项目名称:FubuMVC.Diagnostics,代码行数:30,代码来源:ApplyTracing.cs

示例2: applyOutputs

        protected override DoNext applyOutputs(IOutputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            if (chain.ResourceType().CanBeCastTo<HtmlTag>() || chain.ResourceType().CanBeCastTo<HtmlDocument>())
            {
                node.Add(typeof(HtmlStringWriter<>));
                return DoNext.Stop;
            }

            return DoNext.Continue;
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:10,代码来源:HtmlTagsRule.cs

示例3: IsNotDiagnosticRoute

        public static bool IsNotDiagnosticRoute(BehaviorChain chain)
        {
            if (chain is DiagnosticChain) return false;


            if (chain.Calls.Any(x => x.HandlerType.Assembly == Assembly.GetExecutingAssembly()))
            {
                return false;
            }

            if (chain.Calls.Any(x => x.HasInput && x.InputType().Assembly == Assembly.GetExecutingAssembly()))
            {
                return false;
            }

            if (chain.HasOutput() && chain.ResourceType().Assembly == Assembly.GetExecutingAssembly())
            {
                return false;
            }

            if (chain.HasOutput())
            {
                if (chain.Output.Writers.OfType<ViewNode>().Any(x => x.View.Namespace.Contains("Visualization.Visualizers")))
                {
                    return false;
                }
            }

            return true;
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Diagnostics,代码行数:30,代码来源:EndpointExplorerFubuDiagnostics.cs

示例4: applyOutputs

        protected override DoNext applyOutputs(IOutputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            if (!chain.ResourceType().CanBeCastTo<AjaxContinuation>()) return DoNext.Continue;
       
            node.Add(typeof(AjaxContinuationWriter<>));

            return DoNext.Stop;
        }
开发者ID:cothienlac86,项目名称:fubumvc,代码行数:8,代码来源:AjaxContinuations.cs

示例5: applyInputs

        protected override DoNext applyInputs(IInputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            if (!chain.ResourceType().CanBeCastTo<AjaxContinuation>()) return DoNext.Continue;

            node.Add(typeof(ModelBindingReader<>));
            node.Add(settings.FormatterFor(MimeType.Json));

            return DoNext.Stop;
        }
开发者ID:cothienlac86,项目名称:fubumvc,代码行数:9,代码来源:AjaxContinuations.cs

示例6: applyOutputs

        protected override DoNext applyOutputs(IOutputNode node, BehaviorChain chain, ConnegSettings settings)
        {
            if (chain.ResourceType() == typeof (string))
            {
                node.Add(new StringWriter());

                return DoNext.Stop;
            }

            return base.applyOutputs(node, chain, settings);
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:11,代码来源:StringOutput.cs

示例7: IsNotDiagnosticRoute

        public static bool IsNotDiagnosticRoute(BehaviorChain chain)
        {
            if (chain.Route != null)
            {
                if (chain.Route.Pattern.Contains("_data/" + typeof(RequestLog).Name)) return false;
                if (chain.Route.Pattern.Contains("_data/" + typeof(RouteReport).Name)) return false;

                return !chain.Route.Pattern.Contains(DiagnosticsRegistration.DIAGNOSTICS_URL_ROOT);
            }

            // TODO -- figure out how to do this again
            //            if (chain.As<ITracedModel>().AllEvents().OfType<ChainImported>().Any(x => x.Source.ProvenanceChain.OfType<ServiceRegistryProvenance>().Any(x => x.))
            //            {
            //                return false;
            //            }


            if (chain.Calls.Any(x => x.HandlerType.Assembly == Assembly.GetExecutingAssembly()))
            {
                return false;
            }

            if (chain.Calls.Any(x => x.HasInput && x.InputType().Assembly == Assembly.GetExecutingAssembly()))
            {
                return false;
            }

            if (chain.HasOutput() && chain.ResourceType().Assembly == Assembly.GetExecutingAssembly())
            {
                return false;
            }

            if (chain.HasOutput())
            {
                if (chain.Output.Writers.OfType<ViewNode>().Any(x => x.View.Namespace.Contains("Visualization.Visualizers")))
                {
                    return false;
                }
            }

            return true;
        }
开发者ID:RyanHauert,项目名称:FubuMVC.Diagnostics,代码行数:42,代码来源:EndpointExplorerEndpoint.cs

示例8: WriteBody

 public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell)
 {
     var outputType = chain.ResourceType();
     cell.Append(new LinkTag(outputType.Name, _examplePageUrl + "?model=" + outputType.FullName));
 }
开发者ID:roynmoore,项目名称:fubumvc,代码行数:5,代码来源:ExampleHtmlWriter.cs

示例9: Text

 public string Text(BehaviorChain chain)
 {
     return chain.ResourceType().Name;
 }
开发者ID:roynmoore,项目名称:fubumvc,代码行数:4,代码来源:ExampleHtmlWriter.cs

示例10: Matches

		public bool Matches(BehaviorChain chain)
		{
			return chain.ResourceType().CanBeCastTo<AjaxContinuation>();
		}
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Ajax,代码行数:4,代码来源:ResourceTypeIsAjaxContinuation.cs


注:本文中的BehaviorChain.ResourceType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。