コード例 #1
0
        public void Inject(IInjectionProvider injectionProvider)
        {
            var taskTypeList = _consoleTaskTypeLocator.GetTaskTypes();

            foreach (var type in taskTypeList)
            {
                injectionProvider.Add(type, type, LifetimeMode.Transient);
            }
        }
コード例 #2
0
        public void FindFactories()
        {
            foreach (var container in TypeListContainers)
            {
                if (container.IsInterface || container.IsAbstract)
                {
                    continue;
                }

                var pi         = container.GetProperty("TypeList");
                var interfaces = UtilReflection.GetCleanInterfaces(container);
                if (interfaces.Count != 1)
                {
                    continue;
                }

                var instance = ServiceLocator.GetService(interfaces[0]);
                var typeList = (IList <Type>)pi.GetValue(instance, null);
                foreach (var type in typeList)
                {
                    _injectionProvider.Add(type, type, LifetimeMode.Singleton);
                }
            }
        }