Example #1
0
        private IEnumerable <IActivator> startApplication()
        {
            // Building up the facility first forces the creation of the container
            // and executes any additional bootstrapping done in the respective lambdas
            facility.SpinUp();


            registry()
            .Services(_fubuFacility.RegisterServices);

            _registryModifications.Each(m => m(registry()));

            FindAllExtensions().Each(x => x.Configure(registry()));

            // "Bake" the fubu configuration model into your
            // IoC container for the application
            _graph = registry().BuildGraph();
            _graph.EachService(facility.Register);
            facility.BuildFactory();

            return(facility.GetAllActivators());
        }
Example #2
0
        public void Bootstrap(ICollection <RouteBase> routes)
        {
            if (HttpContext.Current != null)
            {
                UrlContext.Live();
            }



            // Find all of the IFubuRegistryExtension's and apply
            // them to the top level FubuRegistry *BEFORE*
            // registering the Fubu application parts into
            // your IoC container
            FindAllExtensions().Each(x => x.Configure(_topRegistry));

            // "Bake" the fubu configuration model into your
            // IoC container for the application
            var graph = _topRegistry.BuildGraph();

            graph.EachService(_facility.Register);
            var factory = _facility.BuildFactory();

            // Register all the Route objects into the routes
            // collection

            // TODO -- need a way to do this with debugging
            graph.VisitRoutes(x =>
            {
                x.Actions += (routeDef, chain) =>
                {
                    var route          = routeDef.ToRoute();
                    route.RouteHandler = new FubuRouteHandler(factory, chain.UniqueId);

                    routes.Add(route);
                };
            });
        }