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


C# Builder.AddContactPoint方法代码示例

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


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

示例1: PagingOnBoundStatementTest_Async_UsingConfigBasedPagingSetting

        public void PagingOnBoundStatementTest_Async_UsingConfigBasedPagingSetting()
        {
            var pageSize = 10;
            var queryOptions = new QueryOptions().SetPageSize(pageSize);
            Builder builder = new Builder().WithQueryOptions(queryOptions).WithDefaultKeyspace(KeyspaceName);
            builder.AddContactPoint(TestCluster.InitialContactPoint);

            using (ISession session = builder.Build().Connect())
            {
                var totalRowLength = 1003;
                Tuple<string, string> tableNameAndStaticKeyVal = CreateTableWithCompositeIndexAndInsert(session, totalRowLength);
                string statementToBeBound = "SELECT * from " + tableNameAndStaticKeyVal.Item1 + " where label=?";
                PreparedStatement preparedStatementWithoutPaging = session.Prepare(statementToBeBound);
                PreparedStatement preparedStatementWithPaging = session.Prepare(statementToBeBound);
                BoundStatement boundStatemetWithoutPaging = preparedStatementWithoutPaging.Bind(tableNameAndStaticKeyVal.Item2);
                BoundStatement boundStatemetWithPaging = preparedStatementWithPaging.Bind(tableNameAndStaticKeyVal.Item2);

                var rsWithSessionPagingInherited = session.ExecuteAsync(boundStatemetWithPaging).Result;

                var rsWithoutPagingInherited = Session.Execute(boundStatemetWithoutPaging);

                //Check that the internal list of items count is pageSize
                Assert.AreEqual(pageSize, rsWithSessionPagingInherited.InnerQueueCount);
                Assert.AreEqual(totalRowLength, rsWithoutPagingInherited.InnerQueueCount);

                var allTheRowsPaged = rsWithSessionPagingInherited.ToList();
                Assert.AreEqual(totalRowLength, allTheRowsPaged.Count);
            }
        }
开发者ID:GoldenCrystal,项目名称:csharp-driver,代码行数:29,代码来源:BasicTypeTests.cs

示例2: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            var rp = new RetryLoadBalancingPolicy(new RoundRobinPolicy(), new ConstantReconnectionPolicy(100));
            rp.ReconnectionEvent += (s, ev) => Thread.Sleep((int)ev.DelayMs);
            _builder = Cluster.Builder()
                .WithReconnectionPolicy(new ConstantReconnectionPolicy(100))
                .WithQueryTimeout(60 * 1000)
                .WithLoadBalancingPolicy(rp);

            _builder = _builder.AddContactPoint(TestClusterManager.GetNonShareableTestCluster(NodeCount).InitialContactPoint);
        }
开发者ID:mtf30rob,项目名称:csharp-driver,代码行数:11,代码来源:MultiThreadingTests.cs

示例3: CcmSetup

        public static CcmClusterInfo CcmSetup(int nodeLength, Builder builder = null, string keyspaceName = null, int secondDcNodeLength = 0, bool connect = true)
        {
            var clusterInfo = new CcmClusterInfo();
            if (builder == null)
            {
                builder = Cluster.Builder();
            }
            if (UseRemoteCcm)
            {
                CCMBridge.ReusableCCMCluster.Setup(nodeLength);
                clusterInfo.Cluster = CCMBridge.ReusableCCMCluster.Build(builder);
                if (keyspaceName != null)
                {
                    clusterInfo.Session = CCMBridge.ReusableCCMCluster.Connect(keyspaceName);
                }
            }
            else
            {
                //Create a local instance
                clusterInfo.ConfigDir = TestUtils.CreateTempDirectory();
                var output = TestUtils.ExecuteLocalCcmClusterStart(clusterInfo.ConfigDir, Options.Default.CASSANDRA_VERSION, nodeLength, secondDcNodeLength);

                if (output.ExitCode != 0)
                {
                    throw new TestInfrastructureException("Local ccm could not start: " + output.ToString());
                }
                try
                {
                    if (connect)
                    {
                        clusterInfo.Cluster = builder
                            .AddContactPoint("127.0.0.1")
                            .Build();
                        clusterInfo.Session = clusterInfo.Cluster.Connect();
                        if (keyspaceName != null)
                        {
                            clusterInfo.Session.CreateKeyspaceIfNotExists(keyspaceName);
                            clusterInfo.Session.ChangeKeyspace(keyspaceName);
                        }
                    }
                }
                catch
                {
                    CcmRemove(clusterInfo);
                    throw;
                }
            }
            return clusterInfo;
        }
开发者ID:rasmus-s,项目名称:csharp-driver,代码行数:49,代码来源:TestUtils.cs


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