/// <summary> /// Creates the bootstrap. /// </summary> /// <param name="config">The config.</param> /// <returns></returns> public static IBootstrap CreateBootstrap(SocketBase.Config.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); } #if !NETSTANDARD2_0 var section = config as ConfigurationSection; if (section != null) { ConfigurationWatcher.Watch(section, bootstrap); } #endif return(bootstrap); }
/// <summary> /// Initializes a new instance of the <see cref="AppDomainBootstrap"/> class. /// </summary> /// <param name="config">The config.</param> /// <param name="serviceProvider">A container for service objects.</param> public AppDomainBootstrap(SocketBase.Config.IConfigurationSource config, IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; string startupConfigFile = string.Empty; if (config == null) { throw new ArgumentNullException("config"); } #if !NETSTANDARD2_0 var configSectionSource = config as ConfigurationSection; if (configSectionSource != null) { startupConfigFile = configSectionSource.GetConfigSource(); } //Keep serializable version of configuration if (!config.GetType().IsSerializable) { config = new ConfigurationSource(config); } #else var configurationRoot = new ConfigurationBuilder() .AddInMemoryCollection() .SetBasePath(Directory.GetCurrentDirectory()) .AddXmlFile("App.config", optional: true, reloadOnChange: true) .Build(); config = new ConfigurationSource(new SocketServiceConfig(configurationRoot)); #endif //Still use raw configuration type to bootstrap m_InnerBootstrap = CreateBootstrapWrap(this, config, startupConfigFile); AppDomain.CurrentDomain.SetData("Bootstrap", this); }
public DefaultBootstrapAppDomainWrap(IBootstrap bootstrap, SocketBase.Config.IConfigurationSource config, string startupConfigFile) : base(config, startupConfigFile, bootstrap.ServiceProvider) { m_Bootstrap = bootstrap; }
public AppDomainWorkItemFactoryInfoLoader(SocketBase.Config.IConfigurationSource config) : base(config) { InitliazeValidationAppDomain(); }
protected virtual IBootstrap CreateBootstrapWrap(IBootstrap bootstrap, SocketBase.Config.IConfigurationSource config, string startupConfigFile) { return(new DefaultBootstrapAppDomainWrap(this, config, startupConfigFile)); }
internal override WorkItemFactoryInfoLoader GetWorkItemFactoryInfoLoader(SocketBase.Config.IConfigurationSource config, ILogFactory logFactory) { return(new AppDomainWorkItemFactoryInfoLoader(config, logFactory)); }