当前位置: 首页>>代码示例>>C#>>正文


C# ClusterSettings.With方法代码示例

本文整理汇总了C#中MongoDB.Driver.Core.Configuration.ClusterSettings.With方法的典型用法代码示例。如果您正苦于以下问题:C# ClusterSettings.With方法的具体用法?C# ClusterSettings.With怎么用?C# ClusterSettings.With使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB.Driver.Core.Configuration.ClusterSettings的用法示例。


在下文中一共展示了ClusterSettings.With方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigureCluster

 private ClusterSettings ConfigureCluster(ClusterSettings settings, ClusterKey clusterKey)
 {
     var endPoints = clusterKey.Servers.Select(s => EndPointHelper.Parse(s.ToString()));
     return settings.With(
         connectionMode: clusterKey.ConnectionMode.ToCore(),
         endPoints: Optional.Enumerable(endPoints),
         replicaSetName: clusterKey.ReplicaSetName,
         maxServerSelectionWaitQueueSize: clusterKey.WaitQueueSize,
         serverSelectionTimeout: clusterKey.ServerSelectionTimeout,
         postServerSelector: new LatencyLimitingServerSelector(clusterKey.LocalThreshold));
 }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:11,代码来源:ClusterRegistry.cs

示例2: CreateSubject

        private StubCluster CreateSubject(ClusterConnectionMode connectionMode = ClusterConnectionMode.Automatic, TimeSpan? serverSelectionTimeout = null)
        {
            _settings = _settings.With(connectionMode: connectionMode);
            if (serverSelectionTimeout != null)
            {
                _settings = _settings.With(serverSelectionTimeout: serverSelectionTimeout.Value);
            }

            return new StubCluster(_settings, _mockServerFactory.Object, _capturedEvents);
        }
开发者ID:RavenZZ,项目名称:MDRelation,代码行数:10,代码来源:ClusterTests.cs

示例3: With_replicaSetName_should_return_expected_result

        public void With_replicaSetName_should_return_expected_result()
        {
            var oldReplicaSetName = "abc";
            var newReplicaSetName = "def";
            var subject = new ClusterSettings(replicaSetName: oldReplicaSetName);

            var result = subject.With(replicaSetName: newReplicaSetName);

            result.ConnectionMode.Should().Be(subject.ConnectionMode);
            result.EndPoints.Should().EqualUsing(subject.EndPoints, EndPointHelper.EndPointEqualityComparer);
            result.MaxServerSelectionWaitQueueSize.Should().Be(subject.MaxServerSelectionWaitQueueSize);
            result.ReplicaSetName.Should().Be(newReplicaSetName);
            result.ServerSelectionTimeout.Should().Be(subject.ServerSelectionTimeout);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:14,代码来源:ClusterSettingsTests.cs

示例4: With_serverSelectionTimeout_should_return_expected_result

        public void With_serverSelectionTimeout_should_return_expected_result()
        {
            var oldServerSelectionTimeout = TimeSpan.FromSeconds(1);
            var newServerSelectionTimeout = TimeSpan.FromSeconds(2);
            var subject = new ClusterSettings(serverSelectionTimeout: oldServerSelectionTimeout);

            var result = subject.With(serverSelectionTimeout: newServerSelectionTimeout);

            result.ConnectionMode.Should().Be(subject.ConnectionMode);
            result.EndPoints.Should().EqualUsing(subject.EndPoints, EndPointHelper.EndPointEqualityComparer);
            result.MaxServerSelectionWaitQueueSize.Should().Be(subject.MaxServerSelectionWaitQueueSize);
            result.ReplicaSetName.Should().Be(subject.ReplicaSetName);
            result.ServerSelectionTimeout.Should().Be(newServerSelectionTimeout);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:14,代码来源:ClusterSettingsTests.cs

示例5: With_endPoints_should_return_expected_result

        public void With_endPoints_should_return_expected_result()
        {
            var oldEndPoints = new[] { new DnsEndPoint("remotehost1", 27123) };
            var newEndPoints = new[] { new DnsEndPoint("remotehost2", 27123) };
            var subject = new ClusterSettings(endPoints: oldEndPoints);

            var result = subject.With(endPoints: newEndPoints);

            result.ConnectionMode.Should().Be(subject.ConnectionMode);
            result.EndPoints.Should().EqualUsing(newEndPoints, EndPointHelper.EndPointEqualityComparer);
            result.MaxServerSelectionWaitQueueSize.Should().Be(subject.MaxServerSelectionWaitQueueSize);
            result.ReplicaSetName.Should().Be(subject.ReplicaSetName);
            result.ServerSelectionTimeout.Should().Be(subject.ServerSelectionTimeout);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:14,代码来源:ClusterSettingsTests.cs


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