internal static ListShardMap <TKey> AsListShardMap <TKey>(this ShardMap shardMap, bool throwOnFailure) { Debug.Assert(shardMap != null); ListShardMap <TKey> lsm = null; if (shardMap.MapType == ShardMapType.List) { lsm = shardMap as ListShardMap <TKey>; } if (lsm == null && throwOnFailure) { throw ShardMapExtensions.GetConversionException <TKey>(shardMap.StoreShardMap, "List"); } return(lsm); }
internal static RangeShardMap <TKey> AsRangeShardMap <TKey>(this ShardMap shardMap, bool throwOnFailure) { Debug.Assert(shardMap != null); RangeShardMap <TKey> rsm = null; if (shardMap.MapType == ShardMapType.Range) { rsm = shardMap as RangeShardMap <TKey>; } if (rsm == null && throwOnFailure) { throw ShardMapExtensions.GetConversionException <TKey>(shardMap.StoreShardMap, "Range"); } return(rsm); }
public static RangeShardMap <TKey> AsRangeShardMap <TKey>(this ShardMap shardMap) { ExceptionUtils.DisallowNullArgument(shardMap, "shardMap"); return(ShardMapExtensions.AsRangeShardMap <TKey>(shardMap, true)); }