Ejemplo n.º 1
0
        /// <summary>
        /// Creates an IDistinctMap based on the type.
        /// </summary>
        /// <param name="distinctQueryType">The type of distinct query.</param>
        /// <param name="distinctMapContinuationToken">The continuation token to resume from.</param>
        /// <returns>The appropriate IDistinctMap.</returns>
        public static TryCatch <DistinctMap> TryCreate(
            DistinctQueryType distinctQueryType,
            CosmosElement distinctMapContinuationToken)
        {
            TryCatch <DistinctMap> tryCreateDistinctMap;

            switch (distinctQueryType)
            {
            case DistinctQueryType.None:
                throw new ArgumentException("distinctQueryType can not be None. This part of code is not supposed to be reachable. Please contact support to resolve this issue.");

            case DistinctQueryType.Unordered:
                tryCreateDistinctMap = UnorderdDistinctMap.TryCreate(distinctMapContinuationToken);
                break;

            case DistinctQueryType.Ordered:
                tryCreateDistinctMap = OrderedDistinctMap.TryCreate(distinctMapContinuationToken);
                break;

            default:
                throw new ArgumentException($"Unrecognized DistinctQueryType: {distinctQueryType}.");
            }

            return(tryCreateDistinctMap);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an IDistinctMap based on the type.
        /// </summary>
        /// <param name="distinctQueryType">The type of distinct query.</param>
        /// <param name="distinctMapContinuationToken">The continuation token to resume from.</param>
        /// <returns>The appropriate IDistinctMap.</returns>
        public static DistinctMap Create(
            DistinctQueryType distinctQueryType,
            string distinctMapContinuationToken)
        {
            switch (distinctQueryType)
            {
            case DistinctQueryType.None:
                throw new ArgumentException("distinctQueryType can not be None. This part of code is not supposed to be reachable. Please contact support to resolve this issue.");

            case DistinctQueryType.Unordered:
                return(UnorderdDistinctMap.Create(distinctMapContinuationToken));

            case DistinctQueryType.Ordered:
                return(OrderedDistinctMap.Create(distinctMapContinuationToken));

            default:
                throw new ArgumentException($"Unrecognized DistinctQueryType: {distinctQueryType}.");
            }
        }