/// <summary>
        /// Implementers need to new up a new container.
        /// </summary>
        /// <param name="settings">The settings to check if an existing container exists.</param>
        /// <returns>The new container wrapper.</returns>
        public override IContainer CreateContainer(ReadOnlySettings settings)
        {
            CollectionHolder containerHolder;
            Func <IServiceCollection, UpdateableServiceProvider> serviceProviderFactory = null;

            if (!settings.TryGet(out serviceProviderFactory))
            {
                serviceProviderFactory = sc => new UpdateableServiceProvider(sc);
            }

            if (settings.TryGet(out containerHolder))
            {
                settings.AddStartupDiagnosticsSection("NServiceBus.Extensions.DependencyInjection", new
                {
                    UsingExistingCollection = true
                });

                return(new ServicesObjectBuilder(containerHolder.ExistingCollection, serviceProviderFactory));
            }

            settings.AddStartupDiagnosticsSection("NServiceBus.Extensions.DependencyInjection", new
            {
                UsingExistingCollection = false
            });

            return(new ServicesObjectBuilder(serviceProviderFactory));
        }
Esempio n. 2
0
        /// <summary>
        /// Implementers need to new up a new container.
        /// </summary>
        /// <param name="settings">The settings to check if an existing container exists.</param>
        /// <returns>The new container wrapper.</returns>
        public override IContainer CreateContainer(ReadOnlySettings settings)
        {
            CollectionHolder containerHolder;

            if (settings.TryGet(out containerHolder))
            {
                settings.AddStartupDiagnosticsSection("NServiceBus.Extensions.DependencyInjection", new
                {
                    UsingExistingCollection = true
                });

                return(new ServicesObjectBuilder(containerHolder.ExistingCollection));
            }

            settings.AddStartupDiagnosticsSection("NServiceBus.Extensions.DependencyInjection", new
            {
                UsingExistingCollection = false
            });

            return(new ServicesObjectBuilder());
        }
        /// <summary>
        ///     Implementers need to new up a new container.
        /// </summary>
        /// <param name="settings">The settings to check if an existing container exists.</param>
        /// <returns>The new container wrapper.</returns>
        public override ObjectBuilder.Common.IContainer CreateContainer(ReadOnlySettings settings)
        {
            ContainerHolder containerHolder;

            if (settings.TryGet(out containerHolder))
            {
                settings.AddStartupDiagnosticsSection("NServiceBus.CastleWindsor", new
                {
                    UsingExistingContainer = true
                });

                return(new WindsorObjectBuilder(containerHolder.ExistingContainer));
            }

            settings.AddStartupDiagnosticsSection("NServiceBus.CastleWindsor", new
            {
                UsingExistingContainer = false
            });

            return(new WindsorObjectBuilder());
        }
Esempio n. 4
0
        /// <summary>
        ///     Implementers need to new up a new container.
        /// </summary>
        /// <param name="settings">The settings to check if an existing container exists.</param>
        /// <returns>The new container wrapper.</returns>
        public override ObjectBuilder.Common.IContainer CreateContainer(ReadOnlySettings settings)
        {
            LifetimeScopeHolder scopeHolder;

            if (settings.TryGet(out scopeHolder))
            {
                settings.AddStartupDiagnosticsSection("NServiceBus.Autofac", new
                {
                    UsingExistingLifetimeScope = true
                });

                return(new AutofacObjectBuilder(scopeHolder.ExistingLifetimeScope));
            }

            settings.AddStartupDiagnosticsSection("NServiceBus.Autofac", new
            {
                UsingExistingLifetimeScope = false
            });

            return(new AutofacObjectBuilder());
        }
Esempio n. 5
0
    void CustomDiagnosticsSection(ReadOnlySettings settings)
    {
        #region CustomDiagnosticsSection

        settings.AddStartupDiagnosticsSection(
            sectionName: "MySection",
            section: new
        {
            SomeSetting      = "some data",
            SomeOtherSetting = 10
        });

        #endregion
    }
 static void AddDiagnostics(ReadOnlySettings settings, HostInformation hostInformation)
 {
     settings.AddStartupDiagnosticsSection("Hosting", new
     {
         hostInformation.HostId,
         HostDisplayName = hostInformation.DisplayName,
         RuntimeEnvironment.MachineName,
         OSPlatform = Environment.OSVersion.Platform,
         OSVersion  = Environment.OSVersion.VersionString,
         GCSettings.IsServerGC,
         GCLatencyMode = GCSettings.LatencyMode,
         Environment.ProcessorCount,
         Environment.Is64BitProcess,
         CLRVersion = Environment.Version,
         Environment.WorkingSet,
         Environment.SystemPageSize,
         HostName = Dns.GetHostName(),
         Environment.UserName,
         PathToExe = PathUtilities.SanitizedPath(Environment.CommandLine)
     });
 }