Пример #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));
 }