本文整理汇总了C#中ShardMapManager.CreateRangeShardMap方法的典型用法代码示例。如果您正苦于以下问题:C# ShardMapManager.CreateRangeShardMap方法的具体用法?C# ShardMapManager.CreateRangeShardMap怎么用?C# ShardMapManager.CreateRangeShardMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShardMapManager
的用法示例。
在下文中一共展示了ShardMapManager.CreateRangeShardMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRangeShardMapDefault
public void CreateRangeShardMapDefault()
{
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);
RangeShardMap<int> rsm = smm.CreateRangeShardMap<int>(ShardMapManagerTests.s_shardMapName);
Assert.IsNotNull(rsm);
Assert.AreEqual(ShardMapManagerTests.s_shardMapName, rsm.Name);
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);
}
示例2: CreateRangeShardMapAbortGSM
public void CreateRangeShardMapAbortGSM()
{
ShardMapManager smm = new ShardMapManager(
new SqlShardMapManagerCredentials(Globals.ShardMapManagerConnectionString),
new SqlStoreConnectionFactory(),
new StubStoreOperationFactory()
{
CallBase = true,
CreateAddShardMapGlobalOperationShardMapManagerStringIStoreShardMap =
(_smm, _opname, _ssm) => new NTimeFailingAddShardMapGlobalOperation(10, _smm, _opname, _ssm)
},
new CacheStore(),
ShardMapManagerLoadPolicy.Lazy,
new RetryPolicy(1, TimeSpan.Zero, TimeSpan.Zero, TimeSpan.Zero), RetryBehavior.DefaultRetryBehavior);
bool storeOperationFailed = false;
try
{
RangeShardMap<int> rsm = smm.CreateRangeShardMap<int>(ShardMapManagerTests.s_shardMapName);
Assert.IsNotNull(rsm);
Assert.AreEqual(ShardMapManagerTests.s_shardMapName, rsm.Name);
}
catch (ShardManagementException sme)
{
Assert.AreEqual(ShardManagementErrorCategory.ShardMapManager, sme.ErrorCategory);
Assert.AreEqual(ShardManagementErrorCode.StorageOperationFailure, sme.ErrorCode);
storeOperationFailed = true;
}
Assert.IsTrue(storeOperationFailed);
}