Esempio n. 1
0
        /// <summary>
        /// Creates the bootstrap.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <returns></returns>
        public static IBootstrap CreateBootstrap(IConfigurationSource config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IBootstrap bootstrap;

            if (config.Isolation == IsolationMode.AppDomain)
            {
                bootstrap = new AppDomainBootstrap(config);
            }
            else if (config.Isolation == IsolationMode.Process)
            {
                bootstrap = new ProcessBootstrap(config);
            }
            else
            {
                bootstrap = new DefaultBootstrap(config);
            }

            var section = config as ConfigurationSection;

            if (section != null)
            {
                ConfigurationWatcher.Watch(section, bootstrap);
            }

            return(bootstrap);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the bootstrap.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <param name="serviceProvider">A container for service objects.</param>
        /// <returns></returns>
        public static IBootstrap CreateBootstrap(
            SocketBase.Config.IConfigurationSource config,
            IServiceProvider serviceProvider)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IBootstrap bootstrap;

            if (config.Isolation == IsolationMode.AppDomain)
            {
                bootstrap = new AppDomainBootstrap(config, serviceProvider);
            }
            else if (config.Isolation == IsolationMode.Process)
            {
                bootstrap = new ProcessBootstrap(config, serviceProvider);
            }
            else
            {
                bootstrap = new DefaultBootstrap(config, serviceProvider);
            }

#if !NETSTANDARD2_0
            var section = config as ConfigurationSection;

            if (section != null)
            {
                ConfigurationWatcher.Watch(section, bootstrap);
            }
#endif

            return(bootstrap);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the bootstrap.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <returns></returns>
        public static IBootstrap CreateBootstrap(IConfigurationSource config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            IBootstrap bootstrap;

            if (config.Isolation == IsolationMode.AppDomain)
                bootstrap = new AppDomainBootstrap(config);
            else if (config.Isolation == IsolationMode.Process)
                bootstrap = new ProcessBootstrap(config);
            else
                bootstrap = new DefaultBootstrap(config);

            var section = config as ConfigurationSection;

            if (section != null)
                ConfigurationWatcher.Watch(section, bootstrap);

            return bootstrap;
        }