Beispiel #1
0
        void IChainImporter.Import(BehaviorGraph graph, Action <BehaviorChain> alternation)
        {
            _log.Import(graph.Log);

            graph.Behaviors.Each(b => {
                AddChain(b);
                b.Trace(new ChainImported());
                alternation(b);
            });
        }
Beispiel #2
0
        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);
        }
        public static BehaviorGraph Build(FubuRegistry registry)
        {
            var graph = new BehaviorGraph();

            startBehaviorGraph(registry, graph);
            var config = registry.Config;

            var log = new ConfigLog();

            graph.Services.AddService(log);
            log.Import(config);

            config.Add(new SystemServicesPack());
            config.Add(new DefaultConfigurationPack());

            // Apply settings
            config.RunActions(ConfigurationType.Settings, graph);
            config.Add(new RegisterAllSettings(graph));

            config.AllServiceRegistrations().Each(x => {
                x.Apply(graph.Services);
            });


            config.RunActions(ConfigurationType.Discovery, graph);

            config.UniqueImports().Each(import => import.ImportInto(graph, log));

            config.RunActions(ConfigurationType.Explicit, graph);
            config.RunActions(ConfigurationType.Policy, graph);
            config.RunActions(ConfigurationType.Attributes, graph);
            config.RunActions(ConfigurationType.ModifyRoutes, graph);
            config.RunActions(ConfigurationType.InjectNodes, graph);
            config.RunActions(ConfigurationType.Conneg, graph);
            config.RunActions(ConfigurationType.Attachment, graph);
            config.RunActions(ConfigurationType.Navigation, graph);
            config.RunActions(ConfigurationType.ByNavigation, graph);
            config.RunActions(ConfigurationType.Reordering, graph);
            config.RunActions(ConfigurationType.Instrumentation, graph);


            graph.Services.AddService(config);

            return(graph);
        }