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


C# FubuRegistry.Configure方法代码示例

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


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

示例1: do_nothing_if_tracing_is_off

        public void do_nothing_if_tracing_is_off()
        {
            var registry = new FubuRegistry();
            registry.AlterSettings<DiagnosticsSettings>(x => x.TraceLevel = TraceLevel.None);
            registry.Configure(graph =>
            {
                chain1 = new BehaviorChain();
                chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
                chain1.Route = new RouteDefinition("something");
                graph.AddChain(chain1);

                chain2 = new BehaviorChain();
                chain2.IsPartialOnly = true;
                chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain2);
            });


            registry.Policies.Add<ApplyTracing>();

            var notTracedGraph = BehaviorGraph.BuildFrom(registry);
            notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is DiagnosticBehavior).ShouldBeFalse();
            notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is BehaviorTracer).ShouldBeFalse();
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Diagnostics,代码行数:26,代码来源:ApplyTracingIntegrationTesting.cs

示例2: Configure

        public void Configure(FubuRegistry registry)
        {
            registry
                .Actions
                .FindWith<ExplicitControllerRegistration>();

            registry
                .Views
                .TryToAttachWithDefaultConventions()
                .TryToAttachViewsInPackages();

            registry
                .UseSpark(spark => spark.ConfigureComposer(c => c.AddBinder<DiagnosticsTemplateBinder>()));

            registry.Configure(graph =>
                                   {
                                       var chain = graph.FindHomeChain();
                                       if (chain == null)
                                       {
                                           graph
                                               .BehaviorFor<GettingStartedController>(x => x.Execute(new GettingStartedRequestModel()))
                                               .Route = new RouteDefinition(string.Empty);
                                       }
                                   });
        }
开发者ID:hartez,项目名称:fubumvc,代码行数:25,代码来源:GettingStartedExtension.cs

示例3: Configure

        public void Configure(FubuRegistry registry)
        {
            registry.Policies.Add<ApplyTracing>();
			registry.Policies.Add<DescriptionVisualizationPolicy>();
            registry.Policies.Add<DiagnosticChainsPolicy>();
            registry.Services<DiagnosticServiceRegistry>();

            registry.Configure(graph => {
                var settings = graph.Settings.Get<DiagnosticsSettings>();

                if (settings.TraceLevel == TraceLevel.Verbose)
                {
                    graph.Services.Clear(typeof(IBindingLogger));
                    graph.Services.AddService<IBindingLogger, RecordingBindingLogger>();

                    graph.Services.Clear(typeof(IBindingHistory));
                    graph.Services.AddService<IBindingHistory, BindingHistory>();

                    graph.Services.AddService<ILogListener, RequestTraceListener>();
                }

                if (settings.TraceLevel == TraceLevel.Production)
                {
                    graph.Services.AddService<ILogListener, ProductionModeTraceListener>();
                }
            });

            registry.Policies.Add<DefaultHome>();
        }
开发者ID:ryankelley,项目名称:FubuMVC.Diagnostics,代码行数:29,代码来源:DiagnosticsRegistration.cs

示例4: Configure

        public void Configure(FubuRegistry registry)
        {
            MimeType.New("text/jsx", ".jsx");

            registry.Services<DiagnosticServiceRegistry>();

            registry.AlterSettings<AssetSettings>(x => x.AllowableExtensions.Add(".jsx"));

            registry.AlterSettings<DiagnosticsSettings>(x =>
            {
                x.TraceLevel = TraceLevel.Verbose;
            });

            registry.Configure(graph => {
                var settings = graph.Settings.Get<DiagnosticsSettings>();

                if (settings.TraceLevel == TraceLevel.Verbose)
                {
                    graph.Services.Clear(typeof (IBindingLogger));
                    graph.Services.AddService<IBindingLogger, RecordingBindingLogger>();

                    graph.Services.Clear(typeof (IBindingHistory));
                    graph.Services.AddService<IBindingHistory, BindingHistory>();

                    graph.Services.AddService<ILogListener, RequestTraceListener>();
                }

                if (settings.TraceLevel == TraceLevel.Production)
                {
                    graph.Services.AddService<ILogListener, ProductionModeTraceListener>();
                }
            });
        }
开发者ID:jbogard,项目名称:fubumvc,代码行数:33,代码来源:DiagnosticsRegistration.cs

示例5: Configure

 public void Configure(FubuRegistry registry)
 {
     registry.Configure(graph =>
     {
         graph.Behaviors.Where(PassportConfiguration.RestrictedAction).Each(c =>
         {
             var x = new Wrapper(typeof (AuthenticationPolicy));
             c.Prepend(x);
         });
     });
 }
开发者ID:rauhryan,项目名称:awesomesauce,代码行数:11,代码来源:PassportExtensionRegistry.cs

示例6: Configure

        public void Configure(FubuRegistry registry)
        {
            registry.Route("_fubu/getting_started").Calls<StartingController>(x => x.GettingStarted());

            registry.Configure(graph =>
            {
                var chain = graph.FindHomeChain();
                if (chain == null)
                {
                    graph.BehaviorFor<StartingController>(x => x.GettingStarted()).Route = new RouteDefinition(string.Empty);
                }
            });
        }
开发者ID:henninga,项目名称:fubumvc,代码行数:13,代码来源:StartingController.cs

示例7: Configure

        public void Configure(FubuRegistry registry)
        {
            registry.Configure(graph =>
            {
                foreach(var c in graph.Behaviors)
                {
                    if(PassportConfiguration.RestrictedAction(c))
                    {

                    }
                }
            });
        }
开发者ID:KevM,项目名称:awesomesauce,代码行数:13,代码来源:PassportExtensionRegistry.cs

示例8: setupActions

        private BehaviorGraph setupActions()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<RouteAliasAction1>();

            registry.Configure(x =>
            {
                theRouteDefinitionAlias = new RouteDefinition("{Client}/");
                theRouteDefinitionAlias.Input = MockRepository.GenerateMock<IRouteInput>();
                theRouteDefinitionAlias.Input.Stub(_ => _.Rank).Return(5);

                x.BehaviorFor<RouteAliasAction1>(_ => _.M1()).As<RoutedChain>().AddRouteAlias(theRouteDefinitionAlias);
            });

            return BehaviorGraph.BuildFrom(registry);
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:16,代码来源:ChainResoluationCacheRootAt.cs

示例9: adds_the_authentication_node_if_it_exists

        public void adds_the_authentication_node_if_it_exists()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<AuthenticatedEndpoint>();
            registry.Configure(
                graph => { graph.Chains.OfType<RoutedChain>().Each(x => x.Authentication = new AuthNode()); });

            using (var runtime = registry.ToRuntime())
            {
                runtime.Behaviors.ChainFor<AuthenticatedEndpoint>(x => x.get_hello())
                    .First().ShouldBeOfType<AuthNode>();
            }

            var chain = new RoutedChain("something");
            var auth = new AuthNode();
            chain.Authentication = auth;
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:17,代码来源:RoutedChainTester.cs

示例10: Configure

        public void Configure(FubuRegistry registry)
        {
            var tagPolicy = new AutoCompleteTagPolicy();
            

            registry.Actions.FindWith(new LookupActionSource());
            registry.Routes.UrlPolicy<LookupUrlPolicy>();

            registry.Import<HtmlConventionRegistry>(x => x.Editors.Add(tagPolicy));

            registry.Configure(graph => {
                var rules = graph.Settings.Get<AccessorRules>();

//                var strategy = new AutoCompleteStringifierStrategy(rules);
//                var stringifier = graph.Services.DefaultServiceFor<Stringifier>().Value.As<Stringifier>();
//                stringifier.AddStrategy(strategy);

                tagPolicy.Rules = rules;
            });
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.AutoComplete,代码行数:20,代码来源:AutoCompleteEndpoints.cs

示例11: do_nothing_if_tracing_is_off

        public void do_nothing_if_tracing_is_off()
        {
            var registry = new FubuRegistry();
            registry.Features.Diagnostics.Enable(TraceLevel.None);
            registry.Configure(graph =>
            {
                chain1 = new RoutedChain("something");
                chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain1);

                chain2 = new BehaviorChain();
                chain2.IsPartialOnly = true;
                chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain2);
            });

            var notTracedGraph = BehaviorGraph.BuildFrom(registry);
            notTracedGraph.Chains.SelectMany(x => x).Any(x => x is BehaviorTracerNode).ShouldBeFalse();
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:21,代码来源:ApplyTracingIntegrationTesting.cs

示例12: BeforeEach

        public void BeforeEach()
        {
            _parent = new FubuRegistry();
            _parent.IncludeDiagnostics(true);

            _import = new FubuRegistry();
            _import.IncludeDiagnostics(true);
            _import.Actions
                .IncludeType<Handler1>()
                .IncludeType<Handler2>();

            _import.Configure(x =>
            {
                _importObserver = x.Observer;
                _importActions = x.Actions()
                    .Where(a => a.HandlerType.Namespace == GetType().Namespace);
            });

            _parent.Import(_import, "import");
            _parentObserver = _parent.BuildGraph().Observer;
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:21,代码来源:ObserverImporterTester.cs

示例13: SetUp

        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Configure(graph =>
            {
                chain1 = new RoutedChain("something");
                chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain1);

                chain2 = new BehaviorChain();
                chain2.IsPartialOnly = true;
                chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain2);
            });

            registry.Features.Diagnostics.Enable(TraceLevel.Verbose);

            BehaviorGraph.BuildFrom(registry);
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:21,代码来源:ApplyTracingIntegrationTesting.cs

示例14: SetUp

        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Configure(graph =>
            {
                chain1 = new BehaviorChain();
                chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
                chain1.Route = new RouteDefinition("something");
                graph.AddChain(chain1);

                chain2 = new BehaviorChain();
                chain2.IsPartialOnly = true;
                chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
                chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
                graph.AddChain(chain2);

            });

            registry.Policies.Add<ApplyTracing>();

            registry.BuildGraph();
        }
开发者ID:loudej,项目名称:fubumvc,代码行数:23,代码来源:ApplyTracingIntegrationTesting.cs

示例15: action_without_json_attributes_or_JsonMessage_input_model_has_no_conneg

        public void action_without_json_attributes_or_JsonMessage_input_model_has_no_conneg()
        {
            // You have to make the endpoint get some sort of reader/writer to test the negative case,
            // otherwise the default "use json & xml if nothing else is provided" convention
            // takes over
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<JsonController>();
            registry.Configure(graph =>
            {
                graph.Behaviors.Where(x => x.InputType() == typeof (Input1)).Each(chain =>
                {
                    chain.Input.AddFormatter<XmlFormatter>();
                    chain.Output.AddFormatter<XmlFormatter>();
                });
            });

            theGraph = BehaviorGraph.BuildFrom(registry);

            var theChain = theGraph.BehaviorFor(typeof (Input1));

            theChain.Input.UsesFormatter<JsonFormatter>().ShouldBeFalse();
            theChain.Output.UsesFormatter<JsonFormatter>().ShouldBeFalse();
        }
开发者ID:roend83,项目名称:fubumvc,代码行数:23,代码来源:JsonMessageInputConventionTester.cs


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