private MinMaxContinuationToken( MinMaxContinuationTokenType type, CosmosElement value) { switch (type) { case MinMaxContinuationTokenType.MinValue: case MinMaxContinuationTokenType.MaxValue: case MinMaxContinuationTokenType.Undefined: if (value != null) { throw new ArgumentException($"{nameof(value)} must be set with type: {type}."); } break; case MinMaxContinuationTokenType.Value: if (value == null) { throw new ArgumentException($"{nameof(value)} must not be set with type: {type}."); } break; default: throw new ArgumentOutOfRangeException($"Unknown {nameof(type)}: {type}."); } this.Type = type; this.Value = value; }
public static CosmosString ConvertEnumToCosmosString(MinMaxContinuationTokenType type) { switch (type) { case MinMaxContinuationTokenType.MinValue: return(EnumToCosmosString.MinValueCosmosString); case MinMaxContinuationTokenType.MaxValue: return(EnumToCosmosString.MaxValueCosmosString); case MinMaxContinuationTokenType.Undefined: return(EnumToCosmosString.UndefinedCosmosString); case MinMaxContinuationTokenType.Value: return(EnumToCosmosString.ValueCosmosString); default: throw new ArgumentOutOfRangeException($"Unknown {nameof(MinMaxContinuationTokenType)}: {type}"); } }