コード例 #1
0
        /// <summary>Creates a new silo and returns a handle to it.</summary>
        /// <param name="siloName">The name for the new silo.</param>
        /// <param name="configurationSources">
        /// The configuration sources, interpreted by <see cref="TestClusterHostFactory.CreateSiloHost"/>.
        /// </param>
        public static async Task <SiloHandle> CreateAsync(
            string siloName,
            IList <IConfigurationSource> configurationSources)
        {
            var host = TestClusterHostFactory.CreateSiloHost(siloName, configurationSources);
            await host.StartAsync();

            var retValue = new InProcessSiloHandle
            {
                Name           = siloName,
                SiloHost       = host,
                SiloAddress    = host.Services.GetRequiredService <ILocalSiloDetails>().SiloAddress,
                GatewayAddress = host.Services.GetRequiredService <ILocalSiloDetails>().GatewayAddress,
            };

            return(retValue);
        }
コード例 #2
0
        /// <summary>
        /// Create a silo handle.
        /// </summary>
        /// <param name="siloName">Name of the silo.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="postConfigureHostBuilder">An optional delegate which is invoked just prior to building the host builder.</param>
        /// <returns>The silo handle.</returns>
        public static async Task <SiloHandle> CreateAsync(
            string siloName,
            IConfiguration configuration,
            Action <IHostBuilder> postConfigureHostBuilder = null)
        {
            var host = await Task.Run(async() =>
            {
                var result = TestClusterHostFactory.CreateSiloHost(siloName, configuration, postConfigureHostBuilder);
                await result.StartAsync();
                return(result);
            });

            var retValue = new InProcessSiloHandle
            {
                Name           = siloName,
                SiloHost       = host,
                SiloAddress    = host.Services.GetRequiredService <ILocalSiloDetails>().SiloAddress,
                GatewayAddress = host.Services.GetRequiredService <ILocalSiloDetails>().GatewayAddress,
            };

            return(retValue);
        }