Ejemplo n.º 1
0
        public static IClusterClient CreateClusterClient(string hostName, IEnumerable <IConfigurationSource> configurationSources)
        {
            var configBuilder = new ConfigurationBuilder();

            foreach (var source in configurationSources)
            {
                configBuilder.Add(source);
            }
            var configuration = configBuilder.Build();

            var builder = new ClientBuilder();

            builder.Properties["Configuration"] = configuration;
            builder.ConfigureClusterClient(ob => ob.Bind(configuration));
            ConfigureAppServices(configuration, builder);

            builder.ConfigureServices(services =>
            {
                TryConfigureTestClusterMembership(configuration, services);
                TryConfigureFileLogging(configuration, services, hostName);
            });

            AddDefaultApplicationParts(builder.GetApplicationPartManager());
            return(builder.Build());
        }