예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public static IBeanDefinitionCollection AddFromComponentScanner(this IBeanDefinitionCollection beanDefinitions, Assembly assembly, params string[] namespaces)
 {
     return(beanDefinitions.AddFromComponentScanner(c => { }, assembly, namespaces));
 }