示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        public static RangeShardMap <TKey> AsRangeShardMap <TKey>(this ShardMap shardMap)
        {
            ExceptionUtils.DisallowNullArgument(shardMap, "shardMap");

            return(ShardMapExtensions.AsRangeShardMap <TKey>(shardMap, true));
        }