Exemplo n.º 1
0
        /// <summary>
        /// 组件模块初始化
        /// </summary>
        /// <param name="assembly"></param>
        private void ModuleInitialize(Assembly assembly)
        {
            Type componentModuleType = assembly.GetTypes().Where(m => typeof(IComponentModule).IsAssignableFrom(m)).FirstOrDefault();

            if (componentModuleType.IsNotNull() && !componentModuleType.IsInterface)
            {
                IComponentModule componentModule = (IComponentModule)Activator.CreateInstance(componentModuleType);
                componentModule.AssemblyInitialize();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 模块初始化注册信息
 /// </summary>
 public void RegisterInitialize()
 {
     assemblyList.ForEach(assemblyItem => {
         Type componentModuleType = assemblyItem.GetTypes().Where(m => typeof(IComponentModule).IsAssignableFrom(m)).FirstOrDefault();
         if (componentModuleType.IsNotNull() && !componentModuleType.IsInterface)
         {
             IComponentModule componentModule = (IComponentModule)Activator.CreateInstance(componentModuleType);
             componentModule.RegisterInitialize();
         }
     });
 }