internal static void Initialize( ModelBinderDictionary binders, ModelBinderProviderCollection providers ) { binders.Clear(); binders.DefaultBinder = new ExtensibleModelBinderAdapter(providers); }
public void ClearCanBeUsedToRemoveAllRegistrations() { var dictionary = new ModelBinderDictionary(new DefaultModelBinder()); dictionary.Add(typeof(DataSet), FakeBinder); Assert.IsTrue(dictionary.Contains(FakeBinder)); dictionary.Clear(); Assert.IsFalse(dictionary.Contains(FakeBinder)); }
public void Execute(IDictionary <string, object> state) { ModelBinderDictionary modelBinders = container.Resolve <ModelBinderDictionary>(); modelBinders.Clear(); container.Resolve <IRegisterModelBinders>().RegisterModelBinders(modelBinders); foreach (IRegisterModelBinders modelBinderRegistry in container.ResolveAll <IRegisterModelBinders>()) { modelBinderRegistry.RegisterModelBinders(modelBinders); } }
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); }
internal static void Initialize(ModelBinderDictionary binders, ModelBinderProviderCollection providers) { binders.Clear(); binders.DefaultBinder = new ExtensibleModelBinderAdapter(providers); }