コード例 #1
0
ファイル: Configure.cs プロジェクト: xqfgbc/NServiceBus
        internal void Initialize()
        {
            WireUpConfigSectionOverrides();

            featureActivator = new FeatureActivator(Settings);

            configurer.RegisterSingleton(featureActivator);

            ForAllTypes <Feature>(TypesToScan, t => featureActivator.Add(t.Construct <Feature>()));

            ForAllTypes <IWantToRunWhenConfigurationIsComplete>(TypesToScan, t => configurer.ConfigureComponent(t, DependencyLifecycle.InstancePerCall));

            ForAllTypes <IWantToRunWhenBusStartsAndStops>(TypesToScan, t => configurer.ConfigureComponent(t, DependencyLifecycle.InstancePerCall));

            ActivateAndInvoke <IWantToRunBeforeConfigurationIsFinalized>(TypesToScan, t => t.Run(this));

            var featureStats = featureActivator.SetupFeatures(new FeatureConfigurationContext(this));

            configurer.RegisterSingleton(featureStats);

            featureActivator.RegisterStartupTasks(configurer);

            localAddress = Settings.LocalAddress();

            foreach (var o in Builder.BuildAll <IWantToRunWhenConfigurationIsComplete>())
            {
                o.Run(this);
            }
        }