public void Execute(IDictionary <string, object> state) { IModulesLoaded modulesLoaded = container.Resolve <IModulesLoaded>(); RouteCollection routes = container.Resolve <RouteCollection>(); IFilterRegistry filterRegistry = container.Resolve <FilterRegistry>(); ModelBinderDictionary modelBinders = container.Resolve <ModelBinderDictionary>(); filterRegistry.Clear(); modelBinders.Clear(); //todo: (nheskew) get plugin routes registered on load in the right order instead of just clearing the routes before module init routes.Clear(); foreach (Module module in container.Resolve <IModuleService>().GetModules()) { IOxiteModule moduleInstance = modulesLoaded.Load(module); if (moduleInstance != null) { moduleInstance.RegisterWithContainer(); moduleInstance.Initialize(); moduleInstance.RegisterFilters(filterRegistry); moduleInstance.RegisterModelBinders(modelBinders); container.RegisterInstance(modulesLoaded); } } routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.LoadFromModules(modulesLoaded); routes.LoadCatchAllFromModules(modulesLoaded); container.RegisterInstance(filterRegistry); ////TODO: (erikpo) Rename IOxiteModule to IOxiteBackgroundService //IModuleRegistry moduleRegistry = container.Resolve<ModuleRegistry>(); //moduleRegistry.Clear(); //container.Resolve<IRegisterModules>().RegisterModules(moduleRegistry); //foreach (IOxiteModule module in moduleRegistry.GetModules()) // module.Start(); //container.RegisterInstance(moduleRegistry); }
public void Execute(IDictionary <string, object> state) { OxiteConfigurationSection config = container.Resolve <OxiteConfigurationSection>(); IModulesLoaded modulesLoaded = this.container.Resolve <IModulesLoaded>(); RouteCollection routes = this.container.Resolve <RouteCollection>(); IFilterRegistry filterRegistry = this.container.Resolve <FilterRegistry>(); ModelBinderDictionary modelBinders = this.container.Resolve <ModelBinderDictionary>(); filterRegistry.Clear(); modelBinders.Clear(); //todo: (nheskew) get plugin routes registered on load in the right order instead of just clearing the routes before module init routes.Clear(); foreach (OxiteModuleConfigurationElement module in config.Modules) { IOxiteModule moduleInstance = modulesLoaded.Load(config, module); if (moduleInstance != null) { moduleInstance.RegisterWithContainer(); moduleInstance.Initialize(); moduleInstance.RegisterFilters(filterRegistry); moduleInstance.RegisterModelBinders(modelBinders); this.container.RegisterInstance(modulesLoaded); } } routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.LoadFromModules(modulesLoaded); routes.LoadCatchAllFromModules(modulesLoaded); container.RegisterInstance(filterRegistry); }