Example #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);
        }
Example #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);
        }