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


C# ShardMapManager.CreateListShardMap方法代码示例

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


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

示例1: VerifyGlobalStore

        private void VerifyGlobalStore(ShardMapManager smm, Version targetVersion)
        {
            // Verify upgrade
            Assert.AreEqual(
                targetVersion,
                GetGlobalStoreVersion());

            string shardMapName = string.Format("MyShardMap_{0}", Guid.NewGuid());
            if (targetVersion != null && targetVersion < new Version(1, 1))
            {
                ShardManagementException sme = AssertExtensions.AssertThrows<ShardManagementException>(
                    () => smm.CreateListShardMap<int>(shardMapName));
                Assert.AreEqual(ShardManagementErrorCode.GlobalStoreVersionMismatch, sme.ErrorCode);
            }
            else
            {
                // Below call should succeed as latest supported major version of library matches major version of deployed store.
                ShardMap sm = smm.CreateListShardMap<int>(shardMapName);
                Assert.IsNotNull(sm);
            }
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:21,代码来源:ShardMapManagerUpgradeTests.cs

示例2: AddListShardMapNoCacheUpdate

        public void AddListShardMapNoCacheUpdate()
        {
            // Create a cache store that always misses.
            CountingCacheStore cacheStore =
                new CountingCacheStore(
                    new StubCacheStore()
                    {
                        CallBase = true,
                        LookupMappingByKeyIStoreShardMapShardKey = (ssm, sk) => null,
                        LookupShardMapByNameString = (n) => null
                    });

            ShardMapManager smm = new ShardMapManager(
                new SqlShardMapManagerCredentials(Globals.ShardMapManagerConnectionString),
                new SqlStoreConnectionFactory(),
                new StoreOperationFactory(),
                cacheStore,
                ShardMapManagerLoadPolicy.Lazy,
                RetryPolicy.DefaultRetryPolicy, RetryBehavior.DefaultRetryBehavior);

            ShardMap sm = smm.CreateListShardMap<int>(ShardMapManagerTests.s_shardMapName);
            Assert.IsNotNull(sm);
            Assert.AreEqual(ShardMapManagerTests.s_shardMapName, sm.Name);
            Assert.AreEqual(1, cacheStore.AddShardMapCount);
            cacheStore.ResetCounters();

            ShardMap smLookup = smm.LookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.s_shardMapName, true);

            Assert.IsNotNull(smLookup);
            Assert.AreEqual(1, cacheStore.AddShardMapCount);
            Assert.AreEqual(1, cacheStore.LookupShardMapMissCount);
        }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:32,代码来源:ShardMapManagerTests.cs

示例3: RemoveListShardMapNoCacheUpdate

        public void RemoveListShardMapNoCacheUpdate()
        {
            // Counting store that does not perform deletions of shard maps.
            CountingCacheStore cacheStore =
                new CountingCacheStore(
                    new StubCacheStore()
                    {
                        CallBase = true,
                        DeleteShardMapIStoreShardMap = (csm) => { }
                    }
                    );

            ShardMapManager smm = new ShardMapManager(
                new SqlShardMapManagerCredentials(Globals.ShardMapManagerConnectionString),
                new SqlStoreConnectionFactory(),
                new StoreOperationFactory(),
                cacheStore,
                ShardMapManagerLoadPolicy.Lazy,
                RetryPolicy.DefaultRetryPolicy, RetryBehavior.DefaultRetryBehavior);

            ShardMap sm = smm.CreateListShardMap<int>(ShardMapManagerTests.s_shardMapName);

            Assert.IsNotNull(sm);

            Assert.AreEqual(ShardMapManagerTests.s_shardMapName, sm.Name);

            smm.DeleteShardMap(sm);

            Assert.AreEqual(1, cacheStore.DeleteShardMapCount);

            ShardMap smLookup = smm.LookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.s_shardMapName, true);

            Assert.IsNotNull(smLookup);
            Assert.AreEqual(1, cacheStore.LookupShardMapHitCount);
        }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:35,代码来源:ShardMapManagerTests.cs

示例4: RemoveListShardMapAbortGSM

        public void RemoveListShardMapAbortGSM()
        {
            ShardMapManager smm = new ShardMapManager(
                new SqlShardMapManagerCredentials(Globals.ShardMapManagerConnectionString),
                new SqlStoreConnectionFactory(),
                new StubStoreOperationFactory()
                {
                    CallBase = true,
                    CreateRemoveShardMapGlobalOperationShardMapManagerStringIStoreShardMap =
                        (_smm, _opname, _ssm) => new NTimeFailingRemoveShardMapGlobalOperation(10, _smm, _opname, _ssm)
                },
                new CacheStore(),
                ShardMapManagerLoadPolicy.Lazy,
                new RetryPolicy(1, TimeSpan.Zero, TimeSpan.Zero, TimeSpan.Zero), RetryBehavior.DefaultRetryBehavior);

            ShardMap sm = smm.CreateListShardMap<int>(ShardMapManagerTests.s_shardMapName);

            Assert.IsNotNull(sm);

            Assert.AreEqual(ShardMapManagerTests.s_shardMapName, sm.Name);

            bool storeOperationFailed = false;
            try
            {
                smm.DeleteShardMap(sm);
            }
            catch (ShardManagementException sme)
            {
                Assert.AreEqual(ShardManagementErrorCategory.ShardMapManager, sme.ErrorCategory);
                Assert.AreEqual(ShardManagementErrorCode.StorageOperationFailure, sme.ErrorCode);
                storeOperationFailed = true;
            }

            Assert.IsTrue(storeOperationFailed);

            // Verify that shard map still exist in store.
            ShardMap smNew = smm.LookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.s_shardMapName, false);
            Assert.IsNotNull(smNew);
        }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:39,代码来源:ShardMapManagerTests.cs

示例5: DeleteListShardMap

        public void DeleteListShardMap()
        {
            CountingCacheStore cacheStore =
                new CountingCacheStore(
                    new CacheStore());

            ShardMapManager smm = new ShardMapManager(
                new SqlShardMapManagerCredentials(Globals.ShardMapManagerConnectionString),
                new SqlStoreConnectionFactory(),
                new StoreOperationFactory(),
                cacheStore,
                ShardMapManagerLoadPolicy.Lazy,
                RetryPolicy.DefaultRetryPolicy,
                RetryBehavior.DefaultRetryBehavior);

            ShardMap sm = smm.CreateListShardMap<int>(ShardMapManagerTests.s_shardMapName);

            Assert.IsNotNull(sm);

            Assert.AreEqual(ShardMapManagerTests.s_shardMapName, sm.Name);

            ShardMap smLookup = smm.LookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.s_shardMapName, true);

            Assert.IsNotNull(smLookup);
            Assert.AreEqual(1, cacheStore.LookupShardMapCount);
            Assert.AreEqual(1, cacheStore.LookupShardMapHitCount);

            smm.DeleteShardMap(sm);

            Assert.AreEqual(1, cacheStore.DeleteShardMapCount);

            cacheStore.ResetCounters();

            // Verify that shard map is removed from cache.
            ShardMap smLookupFailure = smm.LookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.s_shardMapName, true);

            Assert.IsNull(smLookupFailure);
            Assert.AreEqual(1, cacheStore.LookupShardMapCount);
            Assert.AreEqual(1, cacheStore.LookupShardMapMissCount);
        }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:40,代码来源:ShardMapManagerTests.cs

示例6: CreateListShardMapDefault

        public void CreateListShardMapDefault()
        {
            CountingCacheStore cacheStore =
                new CountingCacheStore(
                    new CacheStore());

            ShardMapManager smm = new ShardMapManager(
                new SqlShardMapManagerCredentials(Globals.ShardMapManagerConnectionString),
                new SqlStoreConnectionFactory(),
                new StoreOperationFactory(),
                cacheStore,
                ShardMapManagerLoadPolicy.Lazy,
                RetryPolicy.DefaultRetryPolicy, RetryBehavior.DefaultRetryBehavior);

            ListShardMap<int> lsm = smm.CreateListShardMap<int>(ShardMapManagerTests.s_shardMapName);

            Assert.IsNotNull(lsm);

            ShardMap smLookup = smm.LookupShardMapByName("LookupShardMapByName", ShardMapManagerTests.s_shardMapName, true);
            Assert.IsNotNull(smLookup);
            Assert.AreEqual(ShardMapManagerTests.s_shardMapName, smLookup.Name);
            Assert.AreEqual(1, cacheStore.LookupShardMapCount);
            Assert.AreEqual(1, cacheStore.LookupShardMapHitCount);
        }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:24,代码来源:ShardMapManagerTests.cs


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