public IList <RouteBase> Bootstrap() { if (HttpContext.Current != null) { UrlContext.Live(); } _fubuFacility = new FubuMvcPackageFacility(); IBehaviorFactory factory = null; BehaviorGraph graph = null; // TODO -- I think Bottles probably needs to enforce a "tell me the paths" // step maybe PackageRegistry.GetApplicationDirectory = FubuMvcPackageFacility.GetApplicationPath; BottleFiles.ContentFolder = FubuMvcPackageFacility.FubuContentFolder; BottleFiles.PackagesFolder = FubuMvcPackageFacility.FubuPackagesFolder; PackageRegistry.LoadPackages(x => { x.Facility(_fubuFacility); _packagingDirectives.Each(d => d(x)); x.Bootstrap(log => { // container facility has to be spun up here var containerFacility = _facility.Value; registerServicesFromFubuFacility(); applyRegistryModifications(); applyFubuExtensionsFromPackages(); graph = buildBehaviorGraph(); bakeBehaviorGraphIntoContainer(graph, containerFacility); // factory HAS to be spun up here. factory = containerFacility.BuildFactory(_registry.Value.DiagnosticLevel); if (_registry.Value.DiagnosticLevel == DiagnosticLevel.FullRequestTracing) { factory = new DiagnosticBehaviorFactory(factory, containerFacility); } return(containerFacility.GetAllActivators()); }); }); PackageRegistry.AssertNoFailures(); return(buildRoutes(factory, graph)); }
public IList <RouteBase> Bootstrap() { if (HttpContext.Current != null) { UrlContext.Live(); } _fubuFacility = new FubuMvcPackageFacility(); // TODO -- would be nice if this little monster also logged PackageRegistry.LoadPackages(x => { x.Facility(_fubuFacility); _packagingDirectives.Each(d => d(x)); x.Bootstrap(log => startApplication()); }); PackageRegistry.AssertNoFailures(); return(buildRoutes()); }
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); }; }); }