• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConnectionSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ConnectionSettings的典型用法代码示例。如果您正苦于以下问题:C# ConnectionSettings类的具体用法?C# ConnectionSettings怎么用?C# ConnectionSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConnectionSettings类属于命名空间,在下文中一共展示了ConnectionSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WhenPostExceedsHttpLimit_DoNotRetry_UsingConnectionPooling

		public void WhenPostExceedsHttpLimit_DoNotRetry_UsingConnectionPooling()
		{
			var pool = new StaticConnectionPool(new []
			{
				new Uri("http://localhost:9200"),
				new Uri("http://127.0.0.1:9200"),
			});
			var settings = new ConnectionSettings(pool);
			var client = new ElasticClient(settings);


			var index = ElasticsearchConfiguration.NewUniqueIndexName();
			var projects = NestTestData.Data;
			var people = NestTestData.People;
			var boolTerms = NestTestData.BoolTerms;
			var bulk = client.Bulk(b => b
				.FixedPath(index)
				.IndexMany(projects)
				.IndexMany(people)
				.IndexMany(boolTerms)
			);

			bulk.IsValid.Should().BeFalse();
			bulk.ConnectionStatus.NumberOfRetries.Should().Be(0);
		}
开发者ID:radiosterne,项目名称:elasticsearch-net,代码行数:25,代码来源:Reproduce945Tests.cs


示例2: EventStoreConnectionLogicHandler

        public EventStoreConnectionLogicHandler(IEventStoreConnection esConnection, ConnectionSettings settings)
        {
            Ensure.NotNull(esConnection, "esConnection");
            Ensure.NotNull(settings, "settings");

            _esConnection = esConnection;
            _settings = settings;

            _operations = new OperationsManager(_esConnection.ConnectionName, settings);
            _subscriptions = new SubscriptionsManager(_esConnection.ConnectionName, settings);

            _queue.RegisterHandler<StartConnectionMessage>(msg => StartConnection(msg.Task, msg.EndPointDiscoverer));
            _queue.RegisterHandler<CloseConnectionMessage>(msg => CloseConnection(msg.Reason, msg.Exception));

            _queue.RegisterHandler<StartOperationMessage>(msg => StartOperation(msg.Operation, msg.MaxRetries, msg.Timeout));
            _queue.RegisterHandler<StartSubscriptionMessage>(StartSubscription);

            _queue.RegisterHandler<EstablishTcpConnectionMessage>(msg => EstablishTcpConnection(msg.EndPoints));
            _queue.RegisterHandler<TcpConnectionEstablishedMessage>(msg => TcpConnectionEstablished(msg.Connection));
            _queue.RegisterHandler<TcpConnectionErrorMessage>(msg => TcpConnectionError(msg.Connection, msg.Exception));
            _queue.RegisterHandler<TcpConnectionClosedMessage>(msg => TcpConnectionClosed(msg.Connection));
            _queue.RegisterHandler<HandleTcpPackageMessage>(msg => HandleTcpPackage(msg.Connection, msg.Package));

            _queue.RegisterHandler<TimerTickMessage>(msg => TimerTick());

            _timer = new Timer(_ => EnqueueMessage(TimerTickMessage), null, Consts.TimerPeriod, Consts.TimerPeriod);
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:27,代码来源:EventStoreConnectionLogicHandler.cs


示例3: ShouldFailoverOnThriftConnectionsUsingSniff

		public void ShouldFailoverOnThriftConnectionsUsingSniff()
		{
			var uris = new []
			{
				new Uri("http://INVALID_HOST"),
				new Uri("http://INVALID_HOST2"),
				new Uri("http://localhost:9500"),
			};
			var connectionPool = new SniffingConnectionPool(uris, randomizeOnStartup: false);
			var settings = new ConnectionSettings(connectionPool, ElasticsearchConfiguration.DefaultIndex)
				.SniffOnStartup()
				.ExposeRawResponse()
				.SetTimeout(2000);
			var client = new ElasticClient(settings, new ThriftConnection(settings));

			var results = client.Search<dynamic>(s => s.MatchAll());
			results.IsValid.Should().BeTrue("{0}", results.ConnectionStatus.ToString());
			results.ConnectionStatus.NumberOfRetries.Should().Be(0);
			var u = new Uri(results.ConnectionStatus.RequestUrl);
			u.Port.Should().Be(9500);

			results = client.Search<dynamic>(s => s.MatchAll());
			results.IsValid.Should().BeTrue("{0}", results.ConnectionStatus.ToString());
			results.ConnectionStatus.NumberOfRetries.Should().Be(0);
			u = new Uri(results.ConnectionStatus.RequestUrl);
			u.Port.Should().Be(9501);
		}
开发者ID:strongant,项目名称:elasticsearch-net,代码行数:27,代码来源:ThiftBugReportTests.cs


示例4: EventStoreEmbeddedNodeConnection

        public EventStoreEmbeddedNodeConnection(ConnectionSettings settings, string connectionName, IPublisher publisher, ISubscriber bus, IAuthenticationProvider authenticationProvider)
        {
            Ensure.NotNull(publisher, "publisher");
            Ensure.NotNull(settings, "settings");

            Guid connectionId = Guid.NewGuid();

            _settings = settings;
            _connectionName = connectionName;
            _publisher = publisher;
            _authenticationProvider = authenticationProvider;
            _subscriptionBus = new InMemoryBus("Embedded Client Subscriptions");
            _subscriptions = new EmbeddedSubscriber(_subscriptionBus, _authenticationProvider, _settings.Log, connectionId);
            
            _subscriptionBus.Subscribe<ClientMessage.SubscriptionConfirmation>(_subscriptions);
            _subscriptionBus.Subscribe<ClientMessage.SubscriptionDropped>(_subscriptions);
            _subscriptionBus.Subscribe<ClientMessage.StreamEventAppeared>(_subscriptions);
            _subscriptionBus.Subscribe<ClientMessage.PersistentSubscriptionConfirmation>(_subscriptions);
            _subscriptionBus.Subscribe<ClientMessage.PersistentSubscriptionStreamEventAppeared>(_subscriptions);
            _subscriptionBus.Subscribe(new AdHocHandler<ClientMessage.SubscribeToStream>(_publisher.Publish));
            _subscriptionBus.Subscribe(new AdHocHandler<ClientMessage.UnsubscribeFromStream>(_publisher.Publish));
            _subscriptionBus.Subscribe(new AdHocHandler<ClientMessage.ConnectToPersistentSubscription>(_publisher.Publish));

            bus.Subscribe(new AdHocHandler<SystemMessage.BecomeShutdown>(_ => Disconnected(this, new ClientConnectionEventArgs(this, new IPEndPoint(IPAddress.None, 0)))));
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:25,代码来源:EventStoreEmbeddedNodeConnection.cs


示例5: SniffOnStartShouldOnlyHit9200_WithoutPing_Async

		public async void SniffOnStartShouldOnlyHit9200_WithoutPing_Async()
		{
			var seeds = new[]
			{
				ElasticsearchConfiguration.CreateBaseUri(9202),
				ElasticsearchConfiguration.CreateBaseUri(9201),
				ElasticsearchConfiguration.CreateBaseUri(9200)
			};
			var sniffingConnectionPool = new SniffingConnectionPool(seeds, randomizeOnStartup: false);
			var connectionSettings = new ConnectionSettings(sniffingConnectionPool)
				.SniffOnStartup();
			var client = new ElasticClient(connectionSettings);
			var rootNode = await client.RootNodeInfoAsync();
			var metrics = rootNode.ConnectionStatus.Metrics;
			
			//When the connectionpool is used for the first time the sniff call should already
			//know only 9200 is on and live, no need to ping
			metrics.Requests.Count.Should().Be(1);
			metrics.Requests[0].Node.Port.Should().Be(9200);
			metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);

			for (var i = 0; i < 3; i++)
			{
				rootNode = await client.RootNodeInfoAsync();
				metrics = rootNode.ConnectionStatus.Metrics;
				metrics.Requests.Count.Should().Be(1);
				metrics.Requests[0].Node.Port.Should().Be(9200);
				metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);
			}

		}
开发者ID:BiYiTuan,项目名称:elasticsearch-net,代码行数:31,代码来源:FailoverSniffOnStartupTests.cs


示例6: SubscriptionsManager

 public SubscriptionsManager(string connectionName, ConnectionSettings settings)
 {
     Ensure.NotNull(connectionName, "connectionName");
     Ensure.NotNull(settings, "settings");
     _connectionName = connectionName;
     _settings = settings;
 }
开发者ID:adbrowne,项目名称:EventStore,代码行数:7,代码来源:SubscriptionsManager.cs


示例7: MailBeeEmailClient

		public MailBeeEmailClient(ConnectionSettings settings)
		{
			_settings = settings;
			_client = settings.GetEmailProtocol() == EmailProtocol.Imap
				? (IMailBeeClient) new ImapMailBeeClient()
				: new Pop3MailBeeClient();
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:7,代码来源:MailBeeEmailClient.cs


示例8: ElasticsearchRepositoryDocumentNotExistsSpecs

        public ElasticsearchRepositoryDocumentNotExistsSpecs()
        {
            var settings = new ConnectionSettings();

            _client = new ElasticClient(settings, new InMemoryConnection(settings, string.Empty, 404));
            _repository = new ElasticsearchRepository(_client);
        }
开发者ID:Philo,项目名称:Nest-Queryify,代码行数:7,代码来源:ElasticsearchRepositoryDocumentNotExistsSpecs.cs


示例9: TestIndexTimeout

        public void TestIndexTimeout()
        {
            var timeout = 1;
            var s = new ConnectionSettings(Test.Default.Host, Test.Default.Port, timeout)
                        .SetDefaultIndex(Test.Default.DefaultIndex)
                        .SetMaximumAsyncConnections(Test.Default.MaximumAsyncConnections)
                        .UsePrettyResponses();

            var client = new ElasticClient(s);

            var newProject = new ElasticSearchProject
            {
                Name = "COBOLES", //COBOL ES client ?
            };
            var t = client.IndexAsync<ElasticSearchProject>(newProject);
            t.Wait(1000);
              var r = t.Result;
              Assert.True(r.IsValid);
              Assert.IsNotNullOrEmpty(r.Id);

            var cs = r.ConnectionStatus;
            Assert.False(cs.Success);
            Assert.NotNull(cs.Error);
            Assert.NotNull(cs.Error.OriginalException);
            Trace.WriteLine(cs.Error.OriginalException);
            Assert.IsNotNullOrEmpty(cs.Error.ExceptionMessage);
            Assert.IsTrue(cs.Error.OriginalException is WebException);
            var we = cs.Error.OriginalException as WebException;
            Assert.IsTrue(cs.Error.ExceptionMessage.Contains("The request was canceled"));
            Assert.IsTrue(we.Status == WebExceptionStatus.RequestCanceled);
            Assert.True(t.IsCompleted, "task did not complete");
            Assert.False(t.IsFaulted, "task was faulted, wich means the exception did not cleanly pass to ConnectionStatus");
        }
开发者ID:Moran007,项目名称:NEST,代码行数:33,代码来源:AsyncTests.cs


示例10: FailoverShouldOnlyPingDeadNodes

		public void FailoverShouldOnlyPingDeadNodes()
		{
			var seeds = new[]
			{
				ElasticsearchConfiguration.CreateBaseUri(9202),
				ElasticsearchConfiguration.CreateBaseUri(9201),
				ElasticsearchConfiguration.CreateBaseUri(9200)
			};
			var sniffingConnectionPool = new SniffingConnectionPool(seeds, randomizeOnStartup: false);
			var connectionSettings = new ConnectionSettings(sniffingConnectionPool);
			var client = new ElasticClient(connectionSettings);
			var rootNode = client.RootNodeInfo();
			var metrics = rootNode.ConnectionStatus.Metrics;
			
			//ping 9202 + 9201 + 9200 and call 9200
			metrics.Requests.Count.Should().Be(4);
			metrics.Requests[0].Node.Port.Should().Be(9202);
			metrics.Requests[0].RequestType.Should().Be(RequestType.Ping);
			metrics.Requests[0].EllapsedMilliseconds.Should().BeLessOrEqualTo(1100);
			metrics.Requests[1].Node.Port.Should().Be(9201);
			metrics.Requests[1].RequestType.Should().Be(RequestType.Ping);
			metrics.Requests[1].EllapsedMilliseconds.Should().BeLessOrEqualTo(1100);
			metrics.Requests[2].Node.Port.Should().Be(9200);
			metrics.Requests[2].RequestType.Should().Be(RequestType.Ping);
			metrics.Requests[2].EllapsedMilliseconds.Should().BeLessOrEqualTo(1100);
			metrics.Requests[3].Node.Port.Should().Be(9200);
			metrics.Requests[3].RequestType.Should().Be(RequestType.ElasticsearchCall);
			metrics.Requests[3].EllapsedMilliseconds.Should().BeLessOrEqualTo(1100);



			rootNode = client.RootNodeInfo();
			metrics = rootNode.ConnectionStatus.Metrics;
			metrics.Requests.Count.Should().Be(1);
			metrics.Requests[0].Node.Port.Should().Be(9200);
			metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);

			rootNode = client.RootNodeInfo();
			metrics = rootNode.ConnectionStatus.Metrics;
			metrics.Requests.Count.Should().Be(1);
			metrics.Requests[0].Node.Port.Should().Be(9200);
			metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);


			rootNode = client.RootNodeInfo();
			metrics = rootNode.ConnectionStatus.Metrics;
			metrics.Requests.Count.Should().Be(1);
			metrics.Requests[0].Node.Port.Should().Be(9200);
			metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);


			rootNode = client.RootNodeInfo();	
			metrics = rootNode.ConnectionStatus.Metrics;
			metrics.Requests.Count.Should().Be(1);
			metrics.Requests[0].Node.Port.Should().Be(9200);
			metrics.Requests[0].RequestType.Should().Be(RequestType.ElasticsearchCall);


		}
开发者ID:strongant,项目名称:elasticsearch-net,代码行数:59,代码来源:FailoverPingTests.cs


示例11: Construct_Client_With_Invalid_Hostname

		public void Construct_Client_With_Invalid_Hostname()
		{
			Assert.Throws<UriFormatException>(() =>
			{
				var settings = new ConnectionSettings(new Uri("some mangled hostname:80"), "index");
			});

		}
开发者ID:JebteK,项目名称:elasticsearch-net,代码行数:8,代码来源:ConnectionTests.cs


示例12: Exchange

        private Exchange(ConnectionSettings connectionSettings, string name, string type, bool durable)
            : base(connectionSettings, name)
        {
            this.Type = type;
            this.Durable = durable;

            this.Channel.ExchangeDeclare(this.Name, this.Type, durable);
        }
开发者ID:ZhangColin,项目名称:IDDD_Samples_by_Colin,代码行数:8,代码来源:Exchange.cs


示例13: DeserializeOfStreamDoesNotHoldACopyOfTheResponse

        public void DeserializeOfStreamDoesNotHoldACopyOfTheResponse()
        {
            var uri = ElasticsearchConfiguration.CreateBaseUri();
            var settings = new ConnectionSettings(uri, ElasticsearchConfiguration.DefaultIndex);
            IElasticClient client = new ElasticClient(settings);

            var results = client.Search<ElasticsearchProject>(s => s.MatchAll());
        }
开发者ID:NickCraver,项目名称:NEST,代码行数:8,代码来源:MemoryUsageTests.cs


示例14: OrganizationRequestBuilderVisitor

 public OrganizationRequestBuilderVisitor(ICrmMetaDataProvider crmMetadataProvider, DbParameterCollection parameters, IDynamicsAttributeTypeProvider typeProvider, ConnectionSettings settings = null)
 {
     CrmMetadataProvider = crmMetadataProvider;
     Parameters = parameters;
     TypeProvider = typeProvider;
     Settings = settings ?? ConnectionSettings.Default();
     // OrgCommand = new OrganisationRequestCommand();
 }
开发者ID:YOTOV-LIMITED,项目名称:CrmAdo,代码行数:8,代码来源:OrganizationRequestBuilderVisitor.cs


示例15: CheckConnection

		private static void CheckConnection(ConnectionSettings settings, PluginProfileErrorCollection errors)
		{
			using (IEmailClient client = new MailBeePop3EmailClient(settings))
			{
				client.CheckConnection(errors);
				client.Disconnect();
			}
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:8,代码来源:CheckConnectionCommand.cs


示例16: IdPropertyNotMapped_IdIsInferred

		public void IdPropertyNotMapped_IdIsInferred()
		{
			var settings = new ConnectionSettings();
			var client = new ElasticClient(settings, connection: new InMemoryConnection());
			var project = new ElasticsearchProject { Id = 123 };

			Assert.AreEqual(project.Id.ToString(), client.Infer.Id<ElasticsearchProject>(project));
		}
开发者ID:strongant,项目名称:elasticsearch-net,代码行数:8,代码来源:MapIdPropertyForTests.cs


示例17: SetConnectionSettings

        /// <summary>
        /// Sets the application network credentials.
        /// </summary>
        /// <param name="credentials">
        /// The credentials.
        /// </param>
        public void SetConnectionSettings(ConnectionSettings credentials)
        {
            ServiceSettings.AuthenticationRequired = credentials.AuthenticationRequired;
            ServiceSettings.Login = credentials.Login;
            ServiceSettings.Password = credentials.Password;
            ServiceSettings.Url = credentials.Url;

            IsolatedStorageSettings.ApplicationSettings["ConnectionSettings"] = credentials;
        }
开发者ID:netconstructor,项目名称:Redmine-Client,代码行数:15,代码来源:ApplicationSettingsManager.cs


示例18: TestConnectSuccessWithUri

		public void TestConnectSuccessWithUri()
		{
			var settings = new ConnectionSettings(ElasticsearchConfiguration.CreateBaseUri(), "index");
			var client = new ElasticClient(settings);
			var result = client.RootNodeInfo();

			Assert.True(result.IsValid);
			Assert.NotNull(result.ConnectionStatus.HttpStatusCode);
		}
开发者ID:JebteK,项目名称:elasticsearch-net,代码行数:9,代码来源:ConnectionTests.cs


示例19: Main

        static void Main(string[] args)
        {
            ConnectionSettings mailBoxSettings = new ConnectionSettings("imap.yandex.ru", 993, true, "[email protected]", "Olya04072010");
            //ConnectionSettings mailBoxSettings = new ConnectionSettings("imap.yandex.ru", 993, true, "[email protected]", "17991837!");
            //ConnectionSettings mailBoxSettings = new ConnectionSettings("imap.gmail.com", 993, true, "[email protected]", "tmg04092014!");

            ICommand command = new CreateRequestReportCommand(mailBoxSettings);
            command.Execute(null);
        }
开发者ID:tmg82,项目名称:MailCollector,代码行数:9,代码来源:Program.cs


示例20: ElasticsearchRepositoryGetByIdSpecs

        public ElasticsearchRepositoryGetByIdSpecs()
        {
            var settings = new ConnectionSettings();

            var output =
                "Nest.Queryify.Tests.TestData.ValidGetResponse.json".ReadAsStringFromEmbeddedResource<ElasticClientQueryObjectTestFixture>();
            _client = new ElasticClient(settings, new InMemoryConnection(settings, output));
            _repository = new ElasticsearchRepository(_client);
        }
开发者ID:Philo,项目名称:Nest-Queryify,代码行数:9,代码来源:ElasticsearchRepositoryGetByIdSpecs.cs



注:本文中的ConnectionSettings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConnectionState类代码示例发布时间:2022-05-24
下一篇:
C# ConnectionResult类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap