Exemplo n.º 1
0
        /// <summary>
        /// 由所有常规注册器注册给定程序集的类型。参见“addConventionalRegistrar”方法。
        /// </summary>
        /// <param name="assembly">要注册的程序集</param>
        /// <param name="config">附加配置</param>
        public void RegisterAssemblyByConvention(Assembly assembly, ConventionalRegistrationConfig config)
        {
            var context = new ConventionalRegistrationContext(assembly, this, config);

            foreach (var registerer in _conventionalRegistrars)
            {
                registerer.RegisterAssembly(context);
            }

            if (config.InstallInstallers)
            {
                IocContainer.Install(FromAssembly.Instance(assembly));
            }
        }
 internal ConventionalRegistrationContext(Assembly assembly, IIocManager iocManager, ConventionalRegistrationConfig config)
 {
     Assembly   = assembly;
     IocManager = iocManager;
     Config     = config;
 }