public override void Initialize()
        {
            var config = new ConventionalRegistrationConfig
            {
                InstallInstallers = false
            };

            config["nameOrConnectionString"] = "CDHotelBusiness";
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly(), config);
            //执行一次.
            IocManager.Resolve <BusinessDbContext>();
        }
Example #2
0
        /// <summary>
        /// Registers types of given assembly by all conventional registerers. See <see cref="AddConventionalRegisterer"/> method.
        /// </summary>
        /// <param name="assembly">Assembly to register</param>
        /// <param name="config">Additional configuration</param>
        public void RegisterAssemblyByConvention(Assembly assembly, ConventionalRegistrationConfig config)
        {
            var context = new ConventionalRegistrationContext(assembly, IocContainer, config);

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

            if (config.InstallInstallers)
            {
                IocContainer.Install(FromAssembly.Instance(assembly));                
            }
        }
Example #3
0
        /// <summary>
        ///     Registers types of given assembly by all conventional registrars. See <see cref="AddConventionalRegistrar" />
        ///     method.
        /// </summary>
        /// <param name="assembly">Assembly to register</param>
        /// <param name="config">Additional configuration</param>
        public void RegisterAssemblyByConvention(Assembly assembly, ConventionalRegistrationConfig config)
        {
            var context = new ConventionalRegistrationContext(assembly, this, config);

            if (config.InstallInstallers)
            {
                IocContainer.Install(FromAssembly.Instance(assembly));
            }

            foreach (var registerer in _conventionalRegistrars)
            {
                registerer.RegisterAssembly(context);
            }
        }
Example #4
0
 public void RegisterAssemblyByConvention(Assembly assembly, ConventionalRegistrationConfig config)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public ConventionalRegistrationContext(Assembly assembly, IIocManager iocManager, ConventionalRegistrationConfig config)
 {
     Assembly   = assembly;
     IocManager = iocManager;
     Config     = config;
 }