當前位置: 首頁>>代碼示例>>C#>>正文


C# BehaviorGraph.As方法代碼示例

本文整理匯總了C#中BehaviorGraph.As方法的典型用法代碼示例。如果您正苦於以下問題:C# BehaviorGraph.As方法的具體用法?C# BehaviorGraph.As怎麽用?C# BehaviorGraph.As使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BehaviorGraph的用法示例。


在下文中一共展示了BehaviorGraph.As方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ImportInto

 public void ImportInto(BehaviorGraph graph)
 {
     // TODO -- will want this to suck in the configuration log business somehow
     Registry.Compile();
     BehaviorGraph childGraph = Registry.Configuration.BuildForImport(graph);
     graph.As<IChainImporter>().Import(childGraph, b => {
         b.PrependToUrl(Prefix);
         b.Origin = Registry.Name;
     });
 }
開發者ID:aluetjen,項目名稱:fubumvc,代碼行數:10,代碼來源:RegistryImport.cs

示例2: ImportInto

        public void ImportInto(BehaviorGraph parent, ConfigLog log)
        {
            var childGraph = BehaviorGraphBuilder.Import(Registry, parent, log);
            parent.As<IChainImporter>().Import(childGraph, b => {
                b.PrependToUrl(Prefix);
                b.Origin = Registry.Name;
            });

            log.Import(Registry.Config, Provenance);
        }
開發者ID:kharlamov,項目名稱:fubumvc,代碼行數:10,代碼來源:RegistryImport.cs

示例3: SetUp

        public void SetUp()
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<FileSystem>().As<IFileSystem>();
            builder.RegisterInstance(MockRepository.GenerateMock<IStreamingData>()).As<IStreamingData>();
            builder.RegisterInstance(new NulloHttpWriter()).As<IHttpWriter>();
            builder.RegisterInstance(new CurrentChain(null, null)).As<ICurrentChain>();
            builder.RegisterInstance(
                new StandInCurrentHttpRequest
                {
                    ApplicationRoot = "http://server"
                }).As<ICurrentHttpRequest>();
            builder.RegisterInstance(MockRepository.GenerateMock<IResourceHash>()).As<IResourceHash>();
            builder.RegisterType<AutofacContainerFacility>().As<IContainerFacility>();
            context = builder.Build();

            graph = BehaviorGraph.BuildFrom(
                x =>
                {
                    x.Route("/area/sub/{Name}/{Age}")
                     .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                    x.Route("/area/sub2/{Name}/{Age}")
                     .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                    x.Route("/area/sub3/{Name}/{Age}")
                     .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                    x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();

                    x.Services(s => s.AddService<IActivator>(new StubActivator()));
                    x.Services(s => s.AddService<IActivator>(new StubActivator()));
                    x.Services(s => s.AddService<IActivator>(new StubActivator()));
                });

            facility = new AutofacContainerFacility(context);
            graph.As<IRegisterable>().Register(facility.Register);

            factory = facility.BuildFactory();
        }
開發者ID:NeilSorensen,項目名稱:fubumvc,代碼行數:40,代碼來源:AutofacContainerFacilityTester.cs

示例4: SetUp

        public void SetUp()
        {
            container = new Container(x => x.For<IFileSystem>().Use<FileSystem>());

            graph = new FubuRegistry(x =>
            {
                x.Route("/area/sub/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub2/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub3/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();

                x.Services(s => s.AddService<IActivator>(new StubActivator()));
                x.Services(s => s.AddService<IActivator>(new StubActivator()));
                x.Services(s => s.AddService<IActivator>(new StubActivator()));

            }).BuildGraph();

            facility = new StructureMapContainerFacility(container);
            graph.As<IRegisterable>().Register(facility.Register);

            factory = facility.BuildFactory(DiagnosticLevel.None);
        }
開發者ID:GunioRobot,項目名稱:fubumvc,代碼行數:28,代碼來源:StructureMapContainerFacilityTester.cs

示例5: SetUp

        public void SetUp()
        {
            registry1 = new FubuRegistry();
            registry1.Actions.IncludeType<RegistryImportEndpoint>();

            theImport = new RegistryImport
            {
                Prefix = "area1",
                Registry = registry1
            };

            graph2 = BehaviorGraph.BuildFrom(x => {
                x.Actions.IncludeType<TestController>();
            });

            graph2.As<IChainImporter>().Import(theImport.BuildChains(graph2.Settings));
        }
開發者ID:swcomp,項目名稱:fubumvc,代碼行數:17,代碼來源:when_importing_urls.cs

示例6: SetUp

        public void SetUp()
        {
            container = new Container(x =>
            {
                x.For<IFileSystem>().Use<FileSystem>();
                x.For<IStreamingData>().Use(MockRepository.GenerateMock<IStreamingData>());
                x.For<IHttpWriter>().Use(new NulloHttpWriter());
                x.For<ICurrentChain>().Use(new CurrentChain(null, null));
                x.For<ICurrentHttpRequest>().Use(new StubCurrentHttpRequest("http://server"));
            });

            container.Configure(x => x.For<IContainerFacility>().Use<StructureMapContainerFacility>());

            graph = new FubuRegistry(x =>
            {
                x.Route("/area/sub/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub2/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Route("/area/sub3/{Name}/{Age}")
                    .Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();

                x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();

                x.Services(s => s.AddService<IActivator>(new StubActivator()));
                x.Services(s => s.AddService<IActivator>(new StubActivator()));
                x.Services(s => s.AddService<IActivator>(new StubActivator()));

            }).BuildGraph();

            facility = new StructureMapContainerFacility(container);
            graph.As<IRegisterable>().Register(DiagnosticLevel.None, facility.Register);

            factory = facility.BuildFactory();
        }
開發者ID:jemacom,項目名稱:fubumvc,代碼行數:37,代碼來源:StructureMapContainerFacilityTester.cs

示例7: SetUp

        public void SetUp()
        {
            container = new Container(x =>
            {
                x.For<IFileSystem>().Use<FileSystem>();
                x.For<IHttpResponse>().Use(new OwinHttpResponse());
                x.For<ICurrentChain>().Use(new CurrentChain(null, null));
                x.For<IHttpRequest>().Use(OwinHttpRequest.ForTesting());

                x.For<IResourceHash>().Use(MockRepository.GenerateMock<IResourceHash>());
            });

            container.Configure(x => x.For<IContainerFacility>().Use<StructureMapContainerFacility>());

            graph = BehaviorGraph.BuildFrom(x => {
                x.Actions.IncludeType<TestController>();

            //                x.Route("/area/sub/{Name}/{Age}")
            //                    .Calls<TestController>(c => c.AnotherAction(null));
            //
            //                x.Route("/area/sub2/{Name}/{Age}")
            //                    .Calls<TestController>(c => c.AnotherAction(null));
            //
            //                x.Route("/area/sub3/{Name}/{Age}")
            //                    .Calls<TestController>(c => c.AnotherAction(null));

                x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();

                x.Services(s => s.AddService<IActivator>(new StubActivator()));
                x.Services(s => s.AddService<IActivator>(new StubActivator()));
                x.Services(s => s.AddService<IActivator>(new StubActivator()));
            });

            facility = new StructureMapContainerFacility(container);
            graph.As<IRegisterable>().Register(facility.Register);

            factory = facility.BuildFactory();
        }
開發者ID:swcomp,項目名稱:fubumvc,代碼行數:38,代碼來源:StructureMapContainerFacilityTester.cs


注:本文中的BehaviorGraph.As方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。