public static IBeanDefinitionCollection AddFromComponentScanner(this IBeanDefinitionCollection beanDefinitions, Action <ComponentScannerOption> config, Assembly assembly, params string[] namespaces) { var opt = new ComponentScannerOption(); config(opt); beanDefinitions.AddFromExisting(new ComponentScanner(opt).ScanAssembly(assembly, namespaces)); return(beanDefinitions); }
public void ConfigureBeans(IBeanDefinitionCollection defCollection) { foreach (var beanDef in defCollection) { if (!BeanDefintionCandidateSelector.Filter(beanDef)) { continue; } BeanDefinitionContainer.RegisterBeanDefinition(beanDef); Sp.UnityContainer.RegisterFactory(beanDef.Type, beanDef.Name, (c, t, n) => beanDef.Constructor(new UnityAddonSP(c), t, n), (IFactoryLifetimeManager)beanDef.Scope); } }
public static IBeanDefinitionCollection AddFromComponentScanner(this IBeanDefinitionCollection beanDefinitions, Assembly assembly, params string[] namespaces) { return(beanDefinitions.AddFromComponentScanner(c => { }, assembly, namespaces)); }