Exemplo n.º 1
0
        /// <summary>
        ///     根据约定注册程序集
        /// </summary>
        /// <param name="assembly"></param>
        /// <param name="config"></param>
        public void RegisterAssemblyByConvention(Assembly assembly, ConventionalRegistrationConfig config)
        {
            var context          = new ConventionalRegistrationContext(assembly, this, config);
            var windsorInstaller = FromAssembly.Instance(assembly);

            foreach (var registerer in _conventionalRegistrars)
            {
                registerer.RegisterAssembly(context);
            }
            if (config.InstallInstallers && windsorInstaller != null)
            {
                Container.Install(windsorInstaller);
            }
            _isRegistrarWindsorInstaller.Add(assembly, windsorInstaller);
        }
 /// <summary>
 ///     构造函数
 /// </summary>
 /// <param name="assembly"></param>
 /// <param name="iocManager"></param>
 /// <param name="config"></param>
 internal ConventionalRegistrationContext(Assembly assembly, IIocManager iocManager, ConventionalRegistrationConfig config)
 {
     Assembly   = assembly;
     IocManager = iocManager;
     Config     = config;
 }