From 9ff29b2c0e6a377b96b9c2a5be407c9f24771371 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Fri, 3 Jun 2022 14:53:37 -0700 Subject: [PATCH] adding queryable extensions to DataServiceQuery --- .../DataServiceQueryExtensions.cs | 1035 +++++++++++++++++ .../PublicAPI.Unshipped.txt | 48 + .../OrderedQueryableExtensions.cs | 24 + src/Microsoft.Spatial/PublicAPI.Unshipped.txt | 4 + src/Microsoft.Spatial/QueryableExtensions.cs | 24 + .../UnitTests/ClientUnitTests/DataBinding.vb | 182 +++ .../Microsoft.OData.PublicApi.net45.bsl | 260 +++++ ...crosoft.OData.PublicApi.netstandard1.1.bsl | 20 + ...crosoft.OData.PublicApi.netstandard2.0.bsl | 260 +++++ 9 files changed, 1857 insertions(+) create mode 100644 src/Microsoft.OData.Client/DataServiceQueryExtensions.cs create mode 100644 src/Microsoft.Spatial/OrderedQueryableExtensions.cs create mode 100644 src/Microsoft.Spatial/QueryableExtensions.cs diff --git a/src/Microsoft.OData.Client/DataServiceQueryExtensions.cs b/src/Microsoft.OData.Client/DataServiceQueryExtensions.cs new file mode 100644 index 0000000000..e2ff8e4d35 --- /dev/null +++ b/src/Microsoft.OData.Client/DataServiceQueryExtensions.cs @@ -0,0 +1,1035 @@ +//--------------------------------------------------------------------- +// +// Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. +// +//--------------------------------------------------------------------- + +namespace Microsoft.OData.Client +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Linq.Expressions; + + using Microsoft.Spatial; + + /// + /// Extension methods for + /// + /// + /// We discussed three options when we decided to implement extension methods for that are analogous to the LINQ extensions + /// for , but that preserve the type. They were: + /// 1. Implement an ExecuteBatch overload on that would take s as parameters + /// 2. Implement a Query extension method that would preserve the type and take in the query + /// that should be applied to the , something like: + /// public static DataServiceQuery>TResult> Query<>TElement, TResult>( + /// this DataServiceQuery>TElement> source, + /// Func>IQueryable>TElement>, IQueryable>TResult>> query) + /// { + /// return new DataServiceQuery>TResult>(query(source).Expression, new DataServiceQueryProvider(source.Context)); + /// } + /// 3. Implement the analogous extension methods as we have done + /// + /// Option 1 has the benefit of being closer to what current callers are doing. Most callers call and then + /// pass the resulting s as parameters to . In this way, + /// they would follow the same pattern, but if the caller uses a LINQ query on some number of the returned s, their code + /// would simply automatically call the new overload for the ExecuteBatch method. + /// + /// Option 2 has the benefit from the development side that there is a single method that needs to be implemented, and it would support all of the LINQ queries. + /// + /// Option 3 has the benefit, like option 1, that it is completely transparent to the caller, and it also allows us to preserve the + /// type for other cases outside of + /// + /// We ruled out option 2 because we decided it was important for the solution to be discoverable. There is already a solution to this issue in the + /// AddQueryOption method, so having an additional solution that callers won't find was not + /// desirable. + /// + /// We ruled out option 1 because type checks are another reason that callers don't like to use + /// . removes the + /// typing from the . Option 1 would also strip out the typing. To preserve the type, there would need to be multiple overloads with + /// different number of type parameters, like: + /// public static DataServiceResponse ExecuteBatch(IQueryable query1) + /// { + /// ... + /// } + /// + /// public static DataServiceResponse ExecuteBatch>T1, T2>(IQueryable>T1> query1, IQueryable>T2> query2) + /// { + /// ... + /// } + /// + /// ... + /// Even if we ignore the typing issue, the new overload would also assume that the s that it receives were generated by the same + /// that the uses. We would have to do this validation at runtime, and errors here would be unintuitive + /// for the caller. + /// + /// Since options 3 preserves the type checks, is highly discoverable by callers, and maintains the current call pattern, we decided it was the best approach. + /// + public static class DataServiceQueryExtensions + { + /// + /// Concatenates two sequences. + /// + /// The type of the elements of the input sequences. + /// The first sequence to concatenate. + /// The sequence to concatenate to the first sequence. + /// A that contains the concatenated elements of the two input sequences. + /// Thrown if or is + public static DataServiceQuery Concat(this DataServiceQuery source1, IEnumerable source2) + { + return new DataServiceQuery(source1.AsQueryable().Concat(source2).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. + /// + /// The type of the elements of . + /// The to return the specified value for if empty. + /// The value to return if the sequence is empty. + /// + /// A that contains if is empty; otherwise, + /// . + /// + /// Thrown if is + public static DataServiceQuery DefaultIfEmpty(this DataServiceQuery source, TSource defaultValue) + { + return new DataServiceQuery(source.AsQueryable().DefaultIfEmpty(defaultValue).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty. + /// + /// The type of the elements of . + /// The to return a default value for if empty. + /// + /// A that contains () if is empty; + /// otherwise, . + /// + /// Thrown if is + public static DataServiceQuery DefaultIfEmpty(this DataServiceQuery source) + { + return new DataServiceQuery(source.AsQueryable().DefaultIfEmpty().Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Returns distinct elements from a sequence by using a specified to compare values. + /// + /// The type of the elements of . + /// The to remove duplicates from. + /// An to compare values. + /// A that contains distinct elements from . + /// Thrown if or is + public static DataServiceQuery Distinct(this DataServiceQuery source, IEqualityComparer comparer) + { + return new DataServiceQuery(source.AsQueryable().Distinct(comparer).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Returns distinct elements from a sequence by using the default equality comparer to compare values. + /// + /// The type of the elements of . + /// The to remove duplicates from. + /// A that contains distinct elements from . + /// Thrown if is + public static DataServiceQuery Distinct(this DataServiceQuery source) + { + return new DataServiceQuery(source.AsQueryable().Distinct().Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Produces the set difference of two sequences by using the default equality comparer to compare values. + /// + /// The type of the elements of the input sequences. + /// A whose elements that are not also in will be returned. + /// An whose elements that also occur in the first sequence will not appear in the returned sequence. + /// A that contains the set difference of the two sequences. + /// Thrown if or is + public static DataServiceQuery Except(this DataServiceQuery source1, IEnumerable source2) + { + return new DataServiceQuery(source1.AsQueryable().Except(source2).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Produces the set difference of two sequences by using the specified to compare values. + /// + /// The type of the elements of the input sequences. + /// A whose elements that are not also in will be returned. + /// An whose elements that also occur in the first sequence will not appear in the returned sequence. + /// An to compare values. + /// A that contains the set difference of the two sequences. + /// Thrown if or is + public static DataServiceQuery Except( + this DataServiceQuery source1, + IEnumerable source2, + IEqualityComparer comparer) + { + return new DataServiceQuery(source1.AsQueryable().Except(source2, comparer).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of + /// each group are projected by using a specified function. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// The type of the elements in each . + /// The type of the result value returned by . + /// A whose elements to group. + /// A function to extract the key for each element. + /// A function to map each source element to an element in an . + /// A function to create a result value from each group. + /// + /// A that has a type argument of and where each element represents a projection over a + /// group and its key. + /// + /// + /// Thrown if or or or is + /// + /// + public static DataServiceQuery GroupBy( + this DataServiceQuery source, + Expression> keySelector, + Expression> elementSelector, + Expression, TResult>> resultSelector) + { + return new DataServiceQuery( + source.AsQueryable().GroupBy(keySelector, elementSelector, resultSelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// The type of the result value returned by . + /// A whose elements to group. + /// A function to extract the key for each element. + /// A function to create a result value from each group. + /// + /// A that has a type argument of and where each element represents a projection over a + /// group and its key. + /// + /// + /// Thrown if or or is + /// + public static DataServiceQuery GroupBy( + this DataServiceQuery source, + Expression> keySelector, + Expression, TResult>> resultSelector) + { + return new DataServiceQuery(source.AsQueryable().GroupBy(keySelector, resultSelector).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// The type of the elements in each . + /// A whose elements to group. + /// A function to extract the key for each element. + /// A function to map each source element to an element in an . + /// + /// A where each element is a and where each + /// contains a sequence of objects of type and a key. + /// + /// + /// Thrown if or or is + /// + public static DataServiceQuery> GroupBy( + this DataServiceQuery source, + Expression> keySelector, + Expression> elementSelector) + { + return new DataServiceQuery>( + source.AsQueryable().GroupBy(keySelector, elementSelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Keys are compared by + /// using a specified comparer and the elements of each group are projected by using a specified function. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// The type of the elements in each . + /// The type of the result value returned by . + /// A whose elements to group. + /// A function to extract the key for each element. + /// A function to map each source element to an element in an . + /// A function to create a result value from each group. + /// A to compare keys. + /// + /// A that has a type argument of and where each element represents a projection over a + /// group and its key. + /// + /// + /// Thrown if or or or or + /// is + /// + public static DataServiceQuery GroupBy( + this DataServiceQuery source, + Expression> keySelector, + Expression> elementSelector, + Expression, TResult>> resultSelector, + IEqualityComparer comparer) + { + return new DataServiceQuery( + source.AsQueryable().GroupBy(keySelector, elementSelector, resultSelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// A whose elements to group. + /// A function to extract the key for each element. + /// + /// A where each element is a and where each + /// contains a sequence of objects and a key. + /// + /// Thrown if or is + public static DataServiceQuery> GroupBy( + this DataServiceQuery source, + Expression> keySelector) + { + return new DataServiceQuery>(source.AsQueryable().GroupBy(keySelector).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Keys are compared by + /// using a specified comparer. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// The type of the result value returned by . + /// A whose elements to group. + /// A function to extract the key for each element. + /// A function to create a result value from each group. + /// An to compare keys. + /// + /// A that has a type argument of and where each element represents a projection over a + /// group and its key. + /// + /// + /// Thrown if or or or is + /// + /// + public static DataServiceQuery GroupBy( + this DataServiceQuery source, + Expression> keySelector, + Expression, TResult>> resultSelector, + IEqualityComparer comparer) + { + return new DataServiceQuery( + source.AsQueryable().GroupBy(keySelector, resultSelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence and projects the elements for each group by using a specified function. Key values are compared by using a specified + /// comparer. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// The type of the elements in each . + /// A whose elements to group. + /// A function to extract the key for each element. + /// A function to map each source element to an element in an . + /// An to compare keys. + /// + /// A where each element is a and where each + /// contains a sequence of objects of type and a key. + /// + /// + /// Thrown if or or or is + /// + /// + public static DataServiceQuery> GroupBy( + this DataServiceQuery source, + Expression> keySelector, + Expression> elementSelector, + IEqualityComparer comparer) + { + return new DataServiceQuery>( + source.AsQueryable().GroupBy(keySelector, elementSelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented in . + /// An whose elements to group. + /// A function to extract the key for each element. + /// An to compare keys. + /// + /// A where each element is a and where each + /// contains a sequence of objects and a key. + /// + /// + /// Thrown if or or is + /// + public static DataServiceQuery> GroupBy( + this DataServiceQuery source, + Expression> keySelector, + IEqualityComparer comparer) + { + return new DataServiceQuery>( + source.AsQueryable().GroupBy(keySelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Correlates the elements of two sequences based on key equality and groups the results. A specified is used to compare + /// keys. + /// + /// The type of the elements of the first sequence. + /// The type of the elements of the second sequence. + /// The type of the keys returned by the key selector functions. + /// The type of the result elements. + /// The first sequence to join. + /// The sequence to join to the first sequence. + /// A function to extract the join key from each element of the first sequence. + /// A function to extract the join key from each element of the second sequence. + /// + /// A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + /// + /// A comparer to hash and compare keys. + /// + /// A that contains elements of type obtained by performing a grouped join on two + /// sequences. + /// + /// + /// Thrown if or or or or + /// or is + /// + public static DataServiceQuery GroupJoin( + this DataServiceQuery outer, + IEnumerable inner, + Expression> outerKeySelector, + Expression> innerKeySelector, + Expression, TResult>> resultSelector, + IEqualityComparer comparer) + { + return new DataServiceQuery( + outer.AsQueryable().GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, comparer).Expression, + new DataServiceQueryProvider(outer.Context)); + } + + /// + /// Correlates the elements of two sequences based on key equality and groups the results. The default equality comparer is used to compare keys. + /// + /// The type of the elements of the first sequence. + /// The type of the elements of the second sequence. + /// The type of the keys returned by the key selector functions. + /// The type of the result elements. + /// The first sequence to join. + /// The sequence to join to the first sequence. + /// A function to extract the join key from each element of the first sequence. + /// A function to extract the join key from each element of the second sequence. + /// + /// A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + /// + /// + /// A that contains elements of type obtained by performing a grouped join on two + /// sequences. + /// + /// + /// Thrown if or or or or + /// is + /// + public static DataServiceQuery GroupJoin( + this DataServiceQuery outer, + IEnumerable inner, + Expression> outerKeySelector, + Expression> innerKeySelector, + Expression, TResult>> resultSelector) + { + return new DataServiceQuery( + outer.AsQueryable().GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector).Expression, + new DataServiceQueryProvider(outer.Context)); + } + + /// + /// Produces the set intersection of two sequences by using the specified to compare values. + /// + /// The type of the elements of the input sequences. + /// A whose distinct elements that also appear in are returned. + /// An whose distinct elements that also appear in the first sequence are returned. + /// An to compare values. + /// A that contains the set intersection of the two sequences. + /// Thrown if or is + public static DataServiceQuery Intersect( + this DataServiceQuery source1, + IEnumerable source2, + IEqualityComparer comparer) + { + return new DataServiceQuery(source1.AsQueryable().Intersect(source2, comparer).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Produces the set intersection of two sequences by using the default equality comparer to compare values. + /// + /// The type of the elements of the input sequences. + /// A sequence whose distinct elements that also appear in are returned. + /// A sequence whose distinct elements that also appear in the first sequence are returned. + /// A sequence that contains the set intersection of the two sequences. + /// Thrown if or is + public static DataServiceQuery Intersect(this DataServiceQuery source1, IEnumerable source2) + { + return new DataServiceQuery(source1.AsQueryable().Intersect(source2).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Correlates the elements of two sequences based on matching keys. A specified is used to compare keys. + /// + /// The type of the elements of the first sequence. + /// The type of the elements of the second sequence. + /// The type of the keys returned by the key selector functions. + /// The type of the result elements. + /// The first sequence to join. + /// The sequence to join to the first sequence. + /// A function to extract the join key from each element of the first sequence. + /// A function to extract the join key from each element of the second sequence. + /// A function to create a result element from two matching elements. + /// An to hash and compare keys. + /// + /// A that has elements of type obtained by performing an inner join on two sequences. + /// + /// + /// Thrown if or or or or + /// is + /// + public static DataServiceQuery Join( + this DataServiceQuery outer, + IEnumerable inner, + Expression> outerKeySelector, + Expression> innerKeySelector, + Expression> resultSelector, + IEqualityComparer comparer) + { + return new DataServiceQuery( + outer.AsQueryable().Join(inner, outerKeySelector, innerKeySelector, resultSelector, comparer).Expression, + new DataServiceQueryProvider(outer.Context)); + } + + /// + /// Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. + /// + /// The type of the elements of the first sequence. + /// The type of the elements of the second sequence. + /// The type of the keys returned by the key selector functions. + /// The type of the result elements. + /// The first sequence to join. + /// The sequence to join to the first sequence. + /// A function to extract the join key from each element of the first sequence. + /// A function to extract the join key from each element of the second sequence. + /// A function to create a result element from two matching elements. + /// + /// A that has elements of type obtained by performing an inner join on two sequences. + /// + /// + /// Thrown if or or or or + /// is + /// + public static DataServiceQuery Join( + this DataServiceQuery outer, + IEnumerable inner, + Expression> outerKeySelector, + Expression> innerKeySelector, + Expression> resultSelector) + { + return new DataServiceQuery( + outer.AsQueryable().Join(inner, outerKeySelector, innerKeySelector, resultSelector).Expression, + new DataServiceQueryProvider(outer.Context)); + } + + /// + /// Sorts the elements of a sequence in ascending order by using a specified comparer. + /// + /// The type of the elements of . + /// The type of the key returned by the function that is represented by . + /// A sequence of values to order. + /// A function to extract a key from an element. + /// An to compare keys. + /// A whose elements are sorted according to a key. + /// + /// Thrown if or or is + /// + public static DataServiceQuery.DataServiceOrderedQuery OrderBy( + this DataServiceQuery source, + Expression> keySelector, + IComparer comparer) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsQueryable().OrderBy(keySelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Sorts the elements of a sequence in ascending order according to a key. + /// + /// The type of the elements of . + /// The type of the key returned by the function that is represented by . + /// A sequence of values to order. + /// A function to extract a key from an element. + /// A whose elements are sorted according to a key. + /// Thrown if or is + public static DataServiceQuery.DataServiceOrderedQuery OrderBy( + this DataServiceQuery source, + Expression> keySelector) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsQueryable().OrderBy(keySelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Sorts the elements of a sequence in descending order according to a key. + /// + /// The type of the elements of . + /// The type of the key returned by the function that is represented by . + /// A sequence of values to order. + /// A function to extract a key from an element. + /// A whose elements are sorted in descending order according to a key. + /// Thrown if or is + public static DataServiceQuery.DataServiceOrderedQuery OrderByDescending( + this DataServiceQuery source, + Expression> keySelector) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsQueryable().OrderByDescending(keySelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Sorts the elements of a sequence in descending order by using a specified comparer. + /// + /// The type of the elements of . + /// The type of the key returned by the function that is represented by . + /// A sequence of values to order. + /// A function to extract a key from an element. + /// An to compare keys. + /// A whose elements are sorted in descending order according to a key. + /// + /// Thrown if or or is + /// + public static DataServiceQuery.DataServiceOrderedQuery OrderByDescending( + this DataServiceQuery source, + Expression> keySelector, + IComparer comparer) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsQueryable().OrderByDescending(keySelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Inverts the order of the elements in a sequence. + /// + /// The type of the elements of . + /// A sequence of values to reverse. + /// A whose elements correspond to those of the input sequence in reverse order. + /// Thrown if is + public static DataServiceQuery Reverse(this DataServiceQuery source) + { + return new DataServiceQuery(source.AsQueryable().Reverse().Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Projects each element of a sequence into a new form by incorporating the element's index. + /// + /// The type of the elements of . + /// The type of the value returned by the function represented by . + /// A sequence of values to project. + /// A projection function to apply to each element. + /// + /// A whose elements are the result of invoking a projection function on each element of . + /// + /// Thrown if or is + public static DataServiceQuery Select(this DataServiceQuery source, Expression> selector) + { + return new DataServiceQuery(source.AsQueryable().Select(selector).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Projects each element of a sequence into a new form. + /// + /// The type of the elements of . + /// The type of the value returned by the function represented by . + /// A sequence of values to project. + /// A projection function to apply to each element. + /// + /// A whose elements are the result of invoking a projection function on each element of . + /// + /// Thrown if or is + public static DataServiceQuery Select(this DataServiceQuery source, Expression> selector) + { + return new DataServiceQuery(source.AsQueryable().Select(selector).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Projects each element of a sequence to an and combines the resulting sequences into one sequence. + /// + /// The type of the elements of . + /// The type of the elements of the sequence returned by the function represented by . + /// A sequence of values to project. + /// A projection function to apply to each element. + /// + /// A whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. + /// + /// Thrown if or is + public static DataServiceQuery SelectMany( + this DataServiceQuery source, + Expression>> selector) + { + return new DataServiceQuery(source.AsQueryable().SelectMany(selector).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Projects each element of a sequence to an and combines the resulting sequences into one sequence. The index of each source + /// element is used in the projected form of that element. + /// + /// The type of the elements of . + /// The type of the elements of the sequence returned by the function represented by . + /// A sequence of values to project. + /// + /// A projection function to apply to each element; the second parameter of this function represents the index of the source element. + /// + /// + /// A whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. + /// + /// Thrown if or is + public static DataServiceQuery SelectMany( + this DataServiceQuery source, + Expression>> selector) + { + return new DataServiceQuery(source.AsQueryable().SelectMany(selector).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Projects each element of a sequence to an that incorporates the index of the source element that produced it. A result selector + /// function is invoked on each element of each intermediate sequence, and the resulting values are combined into a single, one-dimensional sequence and + /// returned. + /// + /// The type of the elements of . + /// + /// The type of the intermediate elements collected by the function represented by . + /// + /// The type of the elements of the resulting sequence. + /// A sequence of values to project. + /// + /// A projection function to apply to each element of the input sequence; the second parameter of this function represents the index of the source element. + /// + /// A projection function to apply to each element of each intermediate sequence. + /// + /// A whose elements are the result of invoking the one-to-many projection function + /// on each element of and then mapping each of those sequence elements and their corresponding + /// element to a result element. + /// + /// + /// Thrown if or or is + /// + public static DataServiceQuery SelectMany( + this DataServiceQuery source, + Expression>> collectionSelector, + Expression> resultSelector) + { + return new DataServiceQuery( + source.AsQueryable().SelectMany(collectionSelector, resultSelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Projects each element of a sequence to an and invokes a result selector function on each element therein. The resulting values + /// from each intermediate sequence are combined into a single, one-dimensional sequence and returned. + /// + /// The type of the elements of . + /// + /// The type of the intermediate elements collected by the function represented by . + /// + /// The type of the elements of the resulting sequence. + /// A sequence of values to project. + /// A projection function to apply to each element of the input sequence. + /// A projection function to apply to each element of each intermediate sequence. + /// + /// A whose elements are the result of invoking the one-to-many projection function + /// on each element of and then mapping each of those sequence elements and their corresponding + /// element to a result element. + /// + /// + /// Thrown if or or is + /// + public static DataServiceQuery SelectMany( + this DataServiceQuery source, + Expression>> collectionSelector, + Expression> resultSelector) + { + return new DataServiceQuery( + source.AsQueryable().SelectMany(collectionSelector, resultSelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Bypasses a specified number of elements in a sequence and then returns the remaining elements. + /// + /// The type of the elements of . + /// A to return elements from. + /// The number of elements to skip before returning the remaining elements. + /// A that contains elements that occur after the specified index in the input sequence. + /// Thrown if is + public static DataServiceQuery Skip(this DataServiceQuery source, int count) + { + return new DataServiceQuery(source.AsQueryable().Skip(count).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. + /// + /// The type of the elements of . + /// A to return elements from. + /// A function to test each element for a condition. + /// + /// A that contains elements from starting at the first element in the linear series that does + /// not pass the test specified by . + /// + /// Thrown if or is + public static DataServiceQuery SkipWhile(this DataServiceQuery source, Expression> predicate) + { + return new DataServiceQuery(source.AsQueryable().SkipWhile(predicate).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of + /// the predicate function. + /// + /// The type of the elements of . + /// A to return elements from. + /// + /// A function to test each element for a condition; the second parameter of this function represents the index of the source element. + /// + /// + /// A that contains elements from starting at the first element in the linear series that does + /// not pass the test specified by . + /// + /// Thrown if or is + public static DataServiceQuery SkipWhile(this DataServiceQuery source, Expression> predicate) + { + return new DataServiceQuery(source.AsQueryable().SkipWhile(predicate).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Returns a specified number of contiguous elements from the start of a sequence. + /// + /// The type of the elements of . + /// The sequence to return elements from. + /// The number of elements to return. + /// A that contains the specified number of elements from the start of . + /// Thrown if is + public static DataServiceQuery Take(this DataServiceQuery source, int count) + { + return new DataServiceQuery(source.AsQueryable().Take(count).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Returns elements from a sequence as long as a specified condition is true. + /// + /// The type of the elements of . + /// The sequence to return elements from. + /// A function to test each element for a condition. + /// + /// A that contains elements from the input sequence occurring before the element at which the test specified by + /// no longer passes. + /// + /// Thrown if or is + public static DataServiceQuery TakeWhile(this DataServiceQuery source, Expression> predicate) + { + return new DataServiceQuery(source.AsQueryable().TakeWhile(predicate).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. + /// + /// The type of the elements of . + /// The sequence to return elements from. + /// + /// A function to test each element for a condition; the second parameter of the function represents the index of the element in the source sequence. + /// + /// + /// A that contains elements from the input sequence occurring before the element at which the test specified by + /// no longer passes. + /// + /// Thrown if or is + public static DataServiceQuery TakeWhile(this DataServiceQuery source, Expression> predicate) + { + return new DataServiceQuery(source.AsQueryable().TakeWhile(predicate).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented by . + /// A that contains elements to sort. + /// A function to extract a key from each element. + /// An to compare keys. + /// A whose elements are sorted according to a key. + /// + /// Thrown if or or is + /// + public static DataServiceQuery.DataServiceOrderedQuery ThenBy( + this DataServiceQuery.DataServiceOrderedQuery source, + Expression> keySelector, + IComparer comparer) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsOrderedQueryable().ThenBy(keySelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in ascending order according to a key. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented by . + /// A that contains elements to sort. + /// A function to extract a key from each element. + /// A whose elements are sorted according to a key. + /// Thrown if or is + public static DataServiceQuery.DataServiceOrderedQuery ThenBy( + this DataServiceQuery.DataServiceOrderedQuery source, + Expression> keySelector) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsOrderedQueryable().ThenBy(keySelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + /// + /// The type of the elements of . + /// The type of the key returned by the function represented by . + /// A that contains elements to sort. + /// A function to extract a key from each element. + /// A whose elements are sorted in descending order according to a key. + /// Thrown if or is + public static DataServiceQuery.DataServiceOrderedQuery ThenByDescending( + this DataServiceQuery.DataServiceOrderedQuery source, + Expression> keySelector) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsOrderedQueryable().ThenByDescending(keySelector).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer. + /// + /// The type of the elements of . + /// The type of the key that is returned by the function. + /// A that contains elements to sort. + /// A function to extract a key from each element. + /// An to compare keys. + /// A collection whose elements are sorted in descending order according to a key. + /// + /// Thrown if or or is + /// + public static DataServiceQuery.DataServiceOrderedQuery ThenByDescending( + this DataServiceQuery.DataServiceOrderedQuery source, + Expression> keySelector, + IComparer comparer) + { + return new DataServiceQuery.DataServiceOrderedQuery( + source.AsOrderedQueryable().ThenByDescending(keySelector, comparer).Expression, + new DataServiceQueryProvider(source.Context)); + } + + /// + /// Produces the set union of two sequences by using a specified . + /// + /// The type of the elements of the input sequences. + /// A sequence whose distinct elements form the first set for the union operation. + /// A sequence whose distinct elements form the second set for the union operation. + /// An to compare values. + /// A that contains the elements from both input sequences, excluding duplicates. + /// Thrown if or is + public static DataServiceQuery Union(this DataServiceQuery source1, IEnumerable source2, IEqualityComparer comparer) + { + return new DataServiceQuery(source1.AsQueryable().Union(source2, comparer).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Produces the set union of two sequences by using the default equality comparer. + /// + /// The type of the elements of the input sequences. + /// A sequence whose distinct elements form the first set for the union operation. + /// A sequence whose distinct elements form the second set for the union operation. + /// A that contains the elements from both input sequences, excluding duplicates. + /// Thrown if or is + public static DataServiceQuery Union(this DataServiceQuery source1, IEnumerable source2) + { + return new DataServiceQuery(source1.AsQueryable().Union(source2).Expression, new DataServiceQueryProvider(source1.Context)); + } + + /// + /// Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. + /// + /// The type of the elements of . + /// A to filter. + /// + /// A function to test each element for a condition; the second parameter of the function represents the index of the element in the source sequence. + /// + /// + /// A that contains elements from the input sequence that satisfy the condition specified by + /// . + /// + /// Thrown if or is + public static DataServiceQuery Where(this DataServiceQuery source, Expression> predicate) + { + return new DataServiceQuery(source.AsQueryable().Where(predicate).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Filters a sequence of values based on a predicate. + /// + /// The type of the elements of . + /// A to filter. + /// A function to test each element for a condition. + /// + /// A that contains elements from the input sequence that satisfy the condition specified by + /// . + /// + /// Thrown if or is + public static DataServiceQuery Where(this DataServiceQuery source, Expression> predicate) + { + return new DataServiceQuery(source.AsQueryable().Where(predicate).Expression, new DataServiceQueryProvider(source.Context)); + } + + /// + /// Merges two sequences by using the specified predicate function. + /// + /// The type of the elements of the first input sequence. + /// The type of the elements of the second input sequence. + /// The type of the elements of the result sequence. + /// The first sequence to merge. + /// The second sequence to merge. + /// A function that specifies how to merge the elements from the two sequences. + /// A that contains merged elements of two input sequences. + /// + /// Thrown if or or is + /// + public static DataServiceQuery Zip( + this DataServiceQuery source1, + IEnumerable source2, + Expression> resultSelector) + { + return new DataServiceQuery(source1.AsQueryable().Zip(source2, resultSelector).Expression, new DataServiceQueryProvider(source1.Context)); + } + } +} diff --git a/src/Microsoft.OData.Client/PublicAPI.Unshipped.txt b/src/Microsoft.OData.Client/PublicAPI.Unshipped.txt index 5a6f505aaf..a633dd37f1 100644 --- a/src/Microsoft.OData.Client/PublicAPI.Unshipped.txt +++ b/src/Microsoft.OData.Client/PublicAPI.Unshipped.txt @@ -374,6 +374,7 @@ Microsoft.OData.Client.DataServiceQueryException.DataServiceQueryException(strin Microsoft.OData.Client.DataServiceQueryException.DataServiceQueryException(string message, System.Exception innerException) -> void Microsoft.OData.Client.DataServiceQueryException.DataServiceQueryException(string message, System.Exception innerException, Microsoft.OData.Client.QueryOperationResponse response) -> void Microsoft.OData.Client.DataServiceQueryException.Response.get -> Microsoft.OData.Client.QueryOperationResponse +Microsoft.OData.Client.DataServiceQueryExtensions Microsoft.OData.Client.DataServiceQueryProvider Microsoft.OData.Client.DataServiceQueryProvider.CreateQuery(System.Linq.Expressions.Expression expression) -> System.Linq.IQueryable Microsoft.OData.Client.DataServiceQueryProvider.CreateQuery(System.Linq.Expressions.Expression expression) -> System.Linq.IQueryable @@ -790,6 +791,53 @@ static Microsoft.OData.Client.ALinq.UriParser.EntitySetAggregateToken.Merge(Micr static Microsoft.OData.Client.ALinq.UriParser.FunctionParameterToken.EmptyParameterList -> Microsoft.OData.Client.ALinq.UriParser.FunctionParameterToken[] static Microsoft.OData.Client.DataServiceExtensions.CountDistinct(this System.Collections.Generic.IEnumerable source, System.Func selector) -> int static Microsoft.OData.Client.DataServiceExtensions.CountDistinct(this System.Linq.IQueryable source, System.Linq.Expressions.Expression> selector) -> int +static Microsoft.OData.Client.DataServiceQueryExtensions.Concat(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.DefaultIfEmpty(this Microsoft.OData.Client.DataServiceQuery source) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.DefaultIfEmpty(this Microsoft.OData.Client.DataServiceQuery source, TSource defaultValue) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Distinct(this Microsoft.OData.Client.DataServiceQuery source) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Distinct(this Microsoft.OData.Client.DataServiceQuery source, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Except(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Except(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Linq.Expressions.Expression> elementSelector, System.Linq.Expressions.Expression, TResult>> resultSelector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Linq.Expressions.Expression> elementSelector, System.Linq.Expressions.Expression, TResult>> resultSelector, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Linq.Expressions.Expression> elementSelector) -> Microsoft.OData.Client.DataServiceQuery> +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Linq.Expressions.Expression> elementSelector, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery> +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Linq.Expressions.Expression, TResult>> resultSelector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Linq.Expressions.Expression, TResult>> resultSelector, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector) -> Microsoft.OData.Client.DataServiceQuery> +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery> +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupJoin(this Microsoft.OData.Client.DataServiceQuery outer, System.Collections.Generic.IEnumerable inner, System.Linq.Expressions.Expression> outerKeySelector, System.Linq.Expressions.Expression> innerKeySelector, System.Linq.Expressions.Expression, TResult>> resultSelector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.GroupJoin(this Microsoft.OData.Client.DataServiceQuery outer, System.Collections.Generic.IEnumerable inner, System.Linq.Expressions.Expression> outerKeySelector, System.Linq.Expressions.Expression> innerKeySelector, System.Linq.Expressions.Expression, TResult>> resultSelector, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Intersect(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Intersect(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Join(this Microsoft.OData.Client.DataServiceQuery outer, System.Collections.Generic.IEnumerable inner, System.Linq.Expressions.Expression> outerKeySelector, System.Linq.Expressions.Expression> innerKeySelector, System.Linq.Expressions.Expression> resultSelector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Join(this Microsoft.OData.Client.DataServiceQuery outer, System.Collections.Generic.IEnumerable inner, System.Linq.Expressions.Expression> outerKeySelector, System.Linq.Expressions.Expression> innerKeySelector, System.Linq.Expressions.Expression> resultSelector, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.OrderBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.OrderBy(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Collections.Generic.IComparer comparer) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.OrderByDescending(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.OrderByDescending(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> keySelector, System.Collections.Generic.IComparer comparer) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Reverse(this Microsoft.OData.Client.DataServiceQuery source) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Select(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> selector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Select(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> selector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.SelectMany(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.SelectMany(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.SelectMany(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression>> selector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.SelectMany(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression>> selector) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Skip(this Microsoft.OData.Client.DataServiceQuery source, int count) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.SkipWhile(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> predicate) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.SkipWhile(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> predicate) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Take(this Microsoft.OData.Client.DataServiceQuery source, int count) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.TakeWhile(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> predicate) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.TakeWhile(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> predicate) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.ThenBy(this Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery source, System.Linq.Expressions.Expression> keySelector) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.ThenBy(this Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery source, System.Linq.Expressions.Expression> keySelector, System.Collections.Generic.IComparer comparer) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.ThenByDescending(this Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery source, System.Linq.Expressions.Expression> keySelector) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.ThenByDescending(this Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery source, System.Linq.Expressions.Expression> keySelector, System.Collections.Generic.IComparer comparer) -> Microsoft.OData.Client.DataServiceQuery.DataServiceOrderedQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Union(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Union(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2, System.Collections.Generic.IEqualityComparer comparer) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Where(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> predicate) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Where(this Microsoft.OData.Client.DataServiceQuery source, System.Linq.Expressions.Expression> predicate) -> Microsoft.OData.Client.DataServiceQuery +static Microsoft.OData.Client.DataServiceQueryExtensions.Zip(this Microsoft.OData.Client.DataServiceQuery source1, System.Collections.Generic.IEnumerable source2, System.Linq.Expressions.Expression> resultSelector) -> Microsoft.OData.Client.DataServiceQuery static Microsoft.OData.Client.DataServiceUrlKeyDelimiter.Parentheses.get -> Microsoft.OData.Client.DataServiceUrlKeyDelimiter static Microsoft.OData.Client.DataServiceUrlKeyDelimiter.Slash.get -> Microsoft.OData.Client.DataServiceUrlKeyDelimiter static Microsoft.OData.Client.Serializer.GetKeyString(Microsoft.OData.Client.DataServiceContext context, System.Collections.Generic.IDictionary keys) -> string diff --git a/src/Microsoft.Spatial/OrderedQueryableExtensions.cs b/src/Microsoft.Spatial/OrderedQueryableExtensions.cs new file mode 100644 index 0000000000..f6ea71e5b4 --- /dev/null +++ b/src/Microsoft.Spatial/OrderedQueryableExtensions.cs @@ -0,0 +1,24 @@ +namespace Microsoft.Spatial +{ + using System.Linq; + using System.Runtime.CompilerServices; + + /// + /// Extension methods for + /// + /// + public static class OrderedQueryableExtensions + { + /// + /// Returns typed as + /// + /// The type of the elements of + /// The queryable to type as + /// The input queryable typed as + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IOrderedQueryable AsOrderedQueryable(this IOrderedQueryable queryable) + { + return queryable; + } + } +} diff --git a/src/Microsoft.Spatial/PublicAPI.Unshipped.txt b/src/Microsoft.Spatial/PublicAPI.Unshipped.txt index 62d2065742..092b3c5070 100644 --- a/src/Microsoft.Spatial/PublicAPI.Unshipped.txt +++ b/src/Microsoft.Spatial/PublicAPI.Unshipped.txt @@ -200,10 +200,12 @@ Microsoft.Spatial.IShapeProvider Microsoft.Spatial.ISpatial Microsoft.Spatial.ISpatial.CoordinateSystem.get -> Microsoft.Spatial.CoordinateSystem Microsoft.Spatial.ISpatial.IsEmpty.get -> bool +Microsoft.Spatial.OrderedQueryableExtensions Microsoft.Spatial.ParseErrorException Microsoft.Spatial.ParseErrorException.ParseErrorException() -> void Microsoft.Spatial.ParseErrorException.ParseErrorException(string message) -> void Microsoft.Spatial.ParseErrorException.ParseErrorException(string message, System.Exception innerException) -> void +Microsoft.Spatial.QueryableExtensions Microsoft.Spatial.SpatialBuilder Microsoft.Spatial.SpatialBuilder.ConstructedGeography.get -> Microsoft.Spatial.Geography Microsoft.Spatial.SpatialBuilder.ConstructedGeometry.get -> Microsoft.Spatial.Geometry @@ -349,6 +351,8 @@ static Microsoft.Spatial.GeometryPoint.Create(Microsoft.Spatial.CoordinateSystem static Microsoft.Spatial.GeometryPosition.operator !=(Microsoft.Spatial.GeometryPosition left, Microsoft.Spatial.GeometryPosition right) -> bool static Microsoft.Spatial.GeometryPosition.operator ==(Microsoft.Spatial.GeometryPosition left, Microsoft.Spatial.GeometryPosition right) -> bool static Microsoft.Spatial.GmlFormatter.Create() -> Microsoft.Spatial.GmlFormatter +static Microsoft.Spatial.OrderedQueryableExtensions.AsOrderedQueryable(this System.Linq.IOrderedQueryable queryable) -> System.Linq.IOrderedQueryable +static Microsoft.Spatial.QueryableExtensions.AsQueryable(this System.Linq.IQueryable queryable) -> System.Linq.IQueryable static Microsoft.Spatial.SpatialBuilder.Create() -> Microsoft.Spatial.SpatialBuilder static Microsoft.Spatial.SpatialImplementation.CurrentImplementation.get -> Microsoft.Spatial.SpatialImplementation static Microsoft.Spatial.SpatialPipeline.implicit operator Microsoft.Spatial.GeographyPipeline(Microsoft.Spatial.SpatialPipeline spatialPipeline) -> Microsoft.Spatial.GeographyPipeline diff --git a/src/Microsoft.Spatial/QueryableExtensions.cs b/src/Microsoft.Spatial/QueryableExtensions.cs new file mode 100644 index 0000000000..a317cdabdd --- /dev/null +++ b/src/Microsoft.Spatial/QueryableExtensions.cs @@ -0,0 +1,24 @@ +namespace Microsoft.Spatial +{ + using System.Linq; + using System.Runtime.CompilerServices; + + /// + /// Extension methods for + /// + /// + public static class QueryableExtensions + { + /// + /// Returns typed as + /// + /// The type of the elements of + /// The queryable to type as + /// The input queryable typed as + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IQueryable AsQueryable(this IQueryable queryable) + { + return queryable; + } + } +} diff --git a/test/FunctionalTests/Tests/DataServices/UnitTests/ClientUnitTests/DataBinding.vb b/test/FunctionalTests/Tests/DataServices/UnitTests/ClientUnitTests/DataBinding.vb index 3bfb3b14a3..0a4e6e7d39 100644 --- a/test/FunctionalTests/Tests/DataServices/UnitTests/ClientUnitTests/DataBinding.vb +++ b/test/FunctionalTests/Tests/DataServices/UnitTests/ClientUnitTests/DataBinding.vb @@ -1319,6 +1319,188 @@ Partial Public Class ClientModule Assert.AreEqual(7, Me.ctx.Entities.Count) End Sub + Private NotInheritable Class CustomerComparer + Implements IComparer(Of NorthwindBindingModel.Customers) + + Private Sub New() + End Sub + + Private Shared ReadOnly _instance As CustomerComparer = New CustomerComparer() + + Public Shared ReadOnly Property Instance() As CustomerComparer + Get + Return _instance + End Get + End Property + + Public Function Compare(x As NorthwindBindingModel.Customers, y As NorthwindBindingModel.Customers) As Integer Implements IComparer(Of NorthwindBindingModel.Customers).Compare + Return 0 + End Function + End Class + + Private NotInheritable Class CustomerEqualityComparer + Implements IEqualityComparer(Of NorthwindBindingModel.Customers) + + Private Sub New() + End Sub + + Private Shared ReadOnly _instance As CustomerEqualityComparer = New CustomerEqualityComparer() + + Public Shared ReadOnly Property Instance() As CustomerEqualityComparer + Get + Return _instance + End Get + End Property + + Function Equals(x As NorthwindBindingModel.Customers, y As NorthwindBindingModel.Customers) As Boolean Implements IEqualityComparer(Of NorthwindBindingModel.Customers).Equals + Return False + End Function + + Function GetHashCode(obj As NorthwindBindingModel.Customers) As Integer Implements IEqualityComparer(Of NorthwindBindingModel.Customers).GetHashCode + Return 0 + End Function + End Class + + Public Sub DataServiceQueryBatch() + Dim allCustomersQuery = Me.ctx.CreateQuery(Of NorthwindBindingModel.Customers)("Customers") + + Dim orderByQuery = allCustomersQuery.OrderBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode) + Dim orderByDescendingQuery = allCustomersQuery.OrderByDescending(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode) + Dim selectQuery = allCustomersQuery.Select(Function(customer As NorthwindBindingModel.Customers) New String(customer.PostalCode)) + Dim selectManyQuery = allCustomersQuery.Where(Function(customer As NorthwindBindingModel.Customers) customer.CustomerID = "ALFKI").SelectMany(Function(customer As NorthwindBindingModel.Customers) customer.Orders) + Dim skipQuery = allCustomersQuery.Skip(10) + Dim takeQuery = allCustomersQuery.Take(10) + Dim thenByQuery = orderByQuery.ThenBy(Function(customer As NorthwindBindingModel.Customers) customer.Phone) + Dim thenByDescendingQuery = orderByQuery.ThenByDescending(Function(customer As NorthwindBindingModel.Customers) customer.Phone) + Dim whereQuery = allCustomersQuery.Where(Function(customer As NorthwindBindingModel.Customers) customer.CustomerID.StartsWith("M")) + + Dim dataServiceResponse = Me.ctx.ExecuteBatch( + allCustomersQuery, + orderByQuery, + orderByDescendingQuery, + selectQuery, + selectManyQuery, + skipQuery, + takeQuery, + thenByQuery, + thenByDescendingQuery, + whereQuery + ).ToArray() + + Dim allCustomers = DirectCast(dataServiceResponse(0), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + Assert.AreNotEqual(0, allCustomers.Length) + + Dim orderByCustomers = DirectCast(dataServiceResponse(1), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + CollectionAssert.AreNotEqual(allCustomers, orderByCustomers) + CollectionAssert.AreEquivalent(allCustomers, orderByCustomers) + + Dim orderByDescendingCustomers = DirectCast(dataServiceResponse(2), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + CollectionAssert.AreNotEqual(allCustomers, orderByDescendingCustomers) + CollectionAssert.AreNotEqual(orderByCustomers, orderByDescendingCustomers) + CollectionAssert.AreEquivalent(allCustomers, orderByDescendingCustomers) + + Dim selectCustomers = DirectCast(dataServiceResponse(3), IEnumerable(Of String)).ToArray() + CollectionAssert.AreEquivalent(allCustomers.Select(Function(customer As NorthwindBindingModel.Customers) If(customer.PostalCode, String.Empty)).ToArray(), selectCustomers) + + Dim selectManyCustomers = DirectCast(dataServiceResponse(4), IEnumerable(Of NorthwindBindingModel.Orders)).ToArray() + Assert.AreNotEqual(allCustomers.Length, selectManyCustomers.Length) + Assert.AreEqual(6, selectManyCustomers.Length) + + Dim skipCustomers = DirectCast(dataServiceResponse(5), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + CollectionAssert.AreEqual(allCustomers.Skip(10).ToArray(), skipCustomers) + + Dim takeCustomers = DirectCast(dataServiceResponse(6), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + CollectionAssert.AreEqual(allCustomers.Take(10).ToArray(), takeCustomers) + + Dim thenByCustomers = DirectCast(dataServiceResponse(7), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + CollectionAssert.AreNotEqual(allCustomers, thenByCustomers) + CollectionAssert.AreNotEqual(orderByCustomers, thenByCustomers) + CollectionAssert.AreEquivalent(allCustomers, thenByCustomers) + + Dim thenByDescendingCustomers = DirectCast(dataServiceResponse(8), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + CollectionAssert.AreNotEqual(allCustomers, thenByDescendingCustomers) + CollectionAssert.AreNotEqual(orderByCustomers, thenByDescendingCustomers) + CollectionAssert.AreNotEqual(thenByCustomers, thenByDescendingCustomers) + CollectionAssert.AreEquivalent(allCustomers, thenByCustomers) + + Dim filterCustomers = DirectCast(dataServiceResponse(9), IEnumerable(Of NorthwindBindingModel.Customers)).ToArray() + Assert.AreNotEqual(allCustomers.Length, filterCustomers.Length) + End Sub + + Public Sub DataServiceQueryUnsupportedBatch() + Dim allCustomersQuery = Me.ctx.CreateQuery(Of NorthwindBindingModel.Customers)("Customers") + Dim orderByQuery = allCustomersQuery.OrderBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode) + + Dim queries = + { + Tuple.Create("concat", allCustomersQuery.Concat(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")})), + Tuple.Create("defaultifempty", allCustomersQuery.DefaultIfEmpty()), + Tuple.Create("defaultifempty", allCustomersQuery.DefaultIfEmpty(New NorthwindBindingModel.Customers())), + Tuple.Create("distinct", allCustomersQuery.Distinct()), + Tuple.Create("distinct", allCustomersQuery.Distinct(CustomerEqualityComparer.Instance)), + Tuple.Create("except", allCustomersQuery.Except(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")})), + Tuple.Create("except", allCustomersQuery.Except(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, CustomerEqualityComparer.Instance)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, Function(customer As NorthwindBindingModel.Customers) customer, Function(postalCode As String, customer As NorthwindBindingModel.Customers) customer)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, Function(postalCode As String, customer As NorthwindBindingModel.Customers) customer)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, Function(customer As NorthwindBindingModel.Customers) customer)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, Function(customer As NorthwindBindingModel.Customers) customer, Function(postalCode As String, customer As NorthwindBindingModel.Customers) customer, StringComparer.OrdinalIgnoreCase)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, Function(postalCode As String, customer As NorthwindBindingModel.Customers) customer, StringComparer.OrdinalIgnoreCase)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, Function(customer As NorthwindBindingModel.Customers) customer, StringComparer.OrdinalIgnoreCase)), + Tuple.Create("groupby", allCustomersQuery.GroupBy(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, StringComparer.OrdinalIgnoreCase)), + Tuple.Create("groupjoin", allCustomersQuery.GroupJoin( + New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(outer As NorthwindBindingModel.Customers, inners As NorthwindBindingModel.Customers()) inners.Count + 1, + StringComparer.OrdinalIgnoreCase)), + Tuple.Create("groupjoin", allCustomersQuery.GroupJoin( + New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(outer As NorthwindBindingModel.Customers, inners As NorthwindBindingModel.Customers()) inners.Count + 1)), + Tuple.Create("intersect", allCustomersQuery.Intersect(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, CustomerEqualityComparer.Instance)), + Tuple.Create("intersect", allCustomersQuery.Intersect(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")})), + Tuple.Create("join", allCustomersQuery.Join( + New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(outer As NorthwindBindingModel.Customers, inner As NorthwindBindingModel.Customers) outer.Phone = inner.Phone, + StringComparer.OrdinalIgnoreCase)), + Tuple.Create("join", allCustomersQuery.Join( + New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(customer As NorthwindBindingModel.Customers) customer.PostalCode, + Function(outer As NorthwindBindingModel.Customers, inner As NorthwindBindingModel.Customers) outer.Phone = inner.Phone)), + Tuple.Create("orderby", allCustomersQuery.OrderBy(Function(customer As NorthwindBindingModel.Customers) customer, CustomerComparer.Instance)), + Tuple.Create("orderbydescending", allCustomersQuery.OrderByDescending(Function(customer As NorthwindBindingModel.Customers) customer, CustomerComparer.Instance)), + Tuple.Create("reverse", allCustomersQuery.Reverse()), + Tuple.Create("select", allCustomersQuery.Select(Function(customer As NorthwindBindingModel.Customers, i As Integer) i)), + Tuple.Create("selectmany", allCustomersQuery.SelectMany(Function(customer As NorthwindBindingModel.Customers) New DataServiceCollection(Of NorthwindBindingModel.Orders)(customer.Orders))), + Tuple.Create("selectmany", allCustomersQuery.SelectMany(Function(customer As NorthwindBindingModel.Customers, i As Integer) New DataServiceCollection(Of NorthwindBindingModel.Orders)(customer.Orders))), + Tuple.Create("selectmany", allCustomersQuery.SelectMany(Function(customer As NorthwindBindingModel.Customers, i As Integer) New DataServiceCollection(Of NorthwindBindingModel.Orders)(customer.Orders), Function(customer As NorthwindBindingModel.Customers, order As NorthwindBindingModel.Orders) order.OrderID)), + Tuple.Create("skipwhile", allCustomersQuery.SkipWhile(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode <> Nothing)), + Tuple.Create("skipwhile", allCustomersQuery.SkipWhile(Function(customer As NorthwindBindingModel.Customers, i As Integer) customer.Orders.Count > i)), + Tuple.Create("takewhile", allCustomersQuery.TakeWhile(Function(customer As NorthwindBindingModel.Customers) customer.PostalCode <> Nothing)), + Tuple.Create("takewhile", allCustomersQuery.TakeWhile(Function(customer As NorthwindBindingModel.Customers, i As Integer) customer.Orders.Count > i)), + Tuple.Create("thenby", orderByQuery.ThenBy(Function(customer As NorthwindBindingModel.Customers) customer, CustomerComparer.Instance)), + Tuple.Create("thenbydescending", orderByQuery.ThenByDescending(Function(customer As NorthwindBindingModel.Customers) customer, CustomerComparer.Instance)), + Tuple.Create("union", allCustomersQuery.Union(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")})), + Tuple.Create("union", allCustomersQuery.Union(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, CustomerEqualityComparer.Instance)), + Tuple.Create("where", allCustomersQuery.Where(Function(customer As NorthwindBindingModel.Customers, i As Integer) customer.CustomerID.StartsWith(i.ToString()))), + Tuple.Create("zip", allCustomersQuery.Zip(New NorthwindBindingModel.Customers() {NorthwindBindingModel.Customers.CreateCustomers("xyzzy", "company")}, Function(customer1 As NorthwindBindingModel.Customers, customer2 As NorthwindBindingModel.Customers) customer1.PostalCode = customer2.PostalCode)) + } + + For Each query In queries + Try + Me.ctx.ExecuteBatch(query.Item2) + Assert.Fail(String.Format("Expected exception for query '{0}'", query.Item1)) + Catch ex As NotSupportedException + Assert.IsTrue(ex.Message.IndexOf(query.Item1, StringComparison.OrdinalIgnoreCase) <> -1) + End Try + Next + End Sub + Public Sub CastResultsToMaterializeAtom() Try Me.ctx.IgnoreResourceNotFoundException = True diff --git a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl index 79df8caf79..e2de8e8e5c 100644 --- a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl +++ b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl @@ -450,6 +450,26 @@ public sealed class Microsoft.Spatial.GeometryOperationsExtensions { public static System.Nullable`1[[System.Double]] Length (Microsoft.Spatial.Geometry operand) } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Spatial.OrderedQueryableExtensions { + [ + ExtensionAttribute(), + ] + public static IOrderedQueryable`1 AsOrderedQueryable (IOrderedQueryable`1 queryable) +} + +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Spatial.QueryableExtensions { + [ + ExtensionAttribute(), + ] + public static IQueryable`1 AsQueryable (IQueryable`1 queryable) +} + [ ExtensionAttribute(), ] @@ -8007,6 +8027,246 @@ public sealed class Microsoft.OData.Client.DataServiceExtensions { public static int CountDistinct (IQueryable`1 source, Expression`1 selector) } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.OData.Client.DataServiceQueryExtensions { + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Concat (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 DefaultIfEmpty (DataServiceQuery`1 source) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 DefaultIfEmpty (DataServiceQuery`1 source, TSource defaultValue) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Distinct (DataServiceQuery`1 source) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Distinct (DataServiceQuery`1 source, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Except (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Except (DataServiceQuery`1 source1, IEnumerable`1 source2, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupJoin (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupJoin (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Intersect (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Intersect (DataServiceQuery`1 source1, IEnumerable`1 source2, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Join (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Join (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderBy (DataServiceQuery`1 source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderBy (DataServiceQuery`1 source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderByDescending (DataServiceQuery`1 source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderByDescending (DataServiceQuery`1 source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Reverse (DataServiceQuery`1 source) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Select (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Select (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 collectionSelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 collectionSelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Skip (DataServiceQuery`1 source, int count) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SkipWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SkipWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Take (DataServiceQuery`1 source, int count) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 TakeWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 TakeWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenBy (DataServiceOrderedQuery source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenBy (DataServiceOrderedQuery source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenByDescending (DataServiceOrderedQuery source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenByDescending (DataServiceOrderedQuery source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Union (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Union (DataServiceQuery`1 source1, IEnumerable`1 source2, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Where (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Where (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Zip (DataServiceQuery`1 source1, IEnumerable`1 source2, Expression`1 resultSelector) +} + [ ExtensionAttribute(), ] diff --git a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl index 06710b6953..41d1f338d8 100644 --- a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl +++ b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl @@ -450,6 +450,26 @@ public sealed class Microsoft.Spatial.GeometryOperationsExtensions { public static System.Nullable`1[[System.Double]] Length (Microsoft.Spatial.Geometry operand) } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Spatial.OrderedQueryableExtensions { + [ + ExtensionAttribute(), + ] + public static IOrderedQueryable`1 AsOrderedQueryable (IOrderedQueryable`1 queryable) +} + +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Spatial.QueryableExtensions { + [ + ExtensionAttribute(), + ] + public static IQueryable`1 AsQueryable (IQueryable`1 queryable) +} + [ ExtensionAttribute(), ] diff --git a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl index 79df8caf79..e2de8e8e5c 100644 --- a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl +++ b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl @@ -450,6 +450,26 @@ public sealed class Microsoft.Spatial.GeometryOperationsExtensions { public static System.Nullable`1[[System.Double]] Length (Microsoft.Spatial.Geometry operand) } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Spatial.OrderedQueryableExtensions { + [ + ExtensionAttribute(), + ] + public static IOrderedQueryable`1 AsOrderedQueryable (IOrderedQueryable`1 queryable) +} + +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Spatial.QueryableExtensions { + [ + ExtensionAttribute(), + ] + public static IQueryable`1 AsQueryable (IQueryable`1 queryable) +} + [ ExtensionAttribute(), ] @@ -8007,6 +8027,246 @@ public sealed class Microsoft.OData.Client.DataServiceExtensions { public static int CountDistinct (IQueryable`1 source, Expression`1 selector) } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.OData.Client.DataServiceQueryExtensions { + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Concat (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 DefaultIfEmpty (DataServiceQuery`1 source) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 DefaultIfEmpty (DataServiceQuery`1 source, TSource defaultValue) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Distinct (DataServiceQuery`1 source) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Distinct (DataServiceQuery`1 source, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Except (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Except (DataServiceQuery`1 source1, IEnumerable`1 source2, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupBy (DataServiceQuery`1 source, Expression`1 keySelector, Expression`1 elementSelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupJoin (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 GroupJoin (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Intersect (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Intersect (DataServiceQuery`1 source1, IEnumerable`1 source2, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Join (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Join (DataServiceQuery`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderBy (DataServiceQuery`1 source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderBy (DataServiceQuery`1 source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderByDescending (DataServiceQuery`1 source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery OrderByDescending (DataServiceQuery`1 source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Reverse (DataServiceQuery`1 source) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Select (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Select (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 selector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 collectionSelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SelectMany (DataServiceQuery`1 source, Expression`1 collectionSelector, Expression`1 resultSelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Skip (DataServiceQuery`1 source, int count) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SkipWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 SkipWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Take (DataServiceQuery`1 source, int count) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 TakeWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 TakeWhile (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenBy (DataServiceOrderedQuery source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenBy (DataServiceOrderedQuery source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenByDescending (DataServiceOrderedQuery source, Expression`1 keySelector) + + [ + ExtensionAttribute(), + ] + public static DataServiceOrderedQuery ThenByDescending (DataServiceOrderedQuery source, Expression`1 keySelector, IComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Union (DataServiceQuery`1 source1, IEnumerable`1 source2) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Union (DataServiceQuery`1 source1, IEnumerable`1 source2, IEqualityComparer`1 comparer) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Where (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Where (DataServiceQuery`1 source, Expression`1 predicate) + + [ + ExtensionAttribute(), + ] + public static DataServiceQuery`1 Zip (DataServiceQuery`1 source1, IEnumerable`1 source2, Expression`1 resultSelector) +} + [ ExtensionAttribute(), ]