public static ShardKeyRange Revive(string key, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(null);
            }

            var argValueSplit = value.Split(new[] { PairSeperator }, StringSplitOptions.RemoveEmptyEntries);

            if (argValueSplit.Length != 2)
            {
                throw new ArgException("Shard key range is not in the expected format of Type|Low,High.");
            }

            var rangeValueSplit = argValueSplit[1].Split(new[] { ValueSeperator }, StringSplitOptions.RemoveEmptyEntries);

            if (rangeValueSplit.Length != 2)
            {
                throw new ArgException("Shard key range is not in the expected format of Type|Low,High.");
            }

            var keyType = ShardKeyArgReviver.GetType(argValueSplit[0]);

            if (keyType == null)
            {
                return(null);
            }

            var converter = TypeDescriptor.GetConverter(keyType);
            var lowValue  = converter.ConvertFrom(rangeValueSplit[0]);
            var highValue = converter.ConvertFrom(rangeValueSplit[1]);

            return(new ShardKeyRange(keyType, lowValue, highValue));
        }
 public static Type Revive(string key, string value)
 {
     return(ShardKeyArgReviver.GetType(value));
 }