Esempio n. 1
0
        private void CreateModules(IocBuilder iocBuilder, IStartupService startupConfiguration, ICollection <Type> moduleTypes)
        {
            foreach (var moduleType in moduleTypes)
            {
                var moduleObject = Activator.CreateInstance(moduleType) as JulyModule;
                if (moduleObject == null)
                {
                    throw new InvalidOperationException("This type is not a July Module: " + moduleType.AssemblyQualifiedName);
                }

                moduleObject.StartupService = startupConfiguration;

                var moduleInfo = new JulyModuleInfo(moduleType);
                moduleInfo.Instance = moduleObject;

                _moduleList.Add(moduleInfo);

                if (moduleType == _moduleList.StartupModuleType)
                {
                    StartupModule = moduleInfo;
                }

                iocBuilder.RegisterInstance(moduleObject).AsSelf().SingleInstance();

                Logger.LogDebug("Create module instance: " + moduleType.AssemblyQualifiedName);
            }
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (!(obj is JulyModuleInfo))
            {
                return(false);
            }

            JulyModuleInfo other = (JulyModuleInfo)obj;

            return(Type == other.Type);
        }