/// <summary>
        /// Builds an <see cref="EntityQuery"/> tied to a specific <see cref="EntityGroup"/> based on a collection of <see cref="EntityKey"/>s
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="entityQuery"></param>
        /// <returns></returns>
        private static EntityQuery AddWhereClause(EntityQuery entityQuery, IEnumerable <EntityKey> keys)
        {
            var lambda = BuildWhereLambda(keys);

            return(AddWhereClause(entityQuery, lambda));
        }
 /// <summary>
 /// Projects each element of a sequence into a new form.
 /// </summary>
 /// <typeparam name="TSource"></typeparam>
 /// <typeparam name="TResult"></typeparam>
 /// <param name="source"></param>
 /// <param name="selector"></param>
 /// <returns></returns>
 /// <include file='EntityQueryExtensions.Examples.xml' path='//Class[@name="EntityQueryExtensions"]/method[@name="Select1"]/*' />
 public static EntityQuery <TResult> Select <TSource, TResult>(this EntityQuery <TSource> source, Expression <Func <TSource, TResult> > selector)
 {
     return((EntityQuery <TResult>)Queryable.Select(source, selector));
 }
 /// <summary>
 /// Bypasses a specified number of elements in a sequence and then returns the remaining elements.
 /// </summary>
 /// <typeparam name="TSource"></typeparam>
 /// <param name="source"></param>
 /// <param name="count"></param>
 /// <returns></returns>
 /// <include file='EntityQueryExtensions.Examples.xml' path='//Class[@name="EntityQueryExtensions"]/method[@name="Skip2"]/*' />
 public static EntityQuery <TSource> Skip <TSource>(this EntityQuery <TSource> source, int count)
 {
     return((EntityQuery <TSource>)Queryable.Skip(source, count));
 }
 public static EntityQuery <TSource> ThenByDescending <TSource, TKey>(this EntityQuery <TSource> source, Expression <Func <TSource, TKey> > keySelector)
 {
     return((EntityQuery <TSource>)Queryable.ThenByDescending(source, keySelector));
 }
 /// <summary>
 /// Sorts the elements of a sequence in ascending order.
 /// </summary>
 /// <typeparam name="TSource"></typeparam>
 /// <typeparam name="TKey"></typeparam>
 /// <param name="source"></param>
 /// <param name="keySelector"></param>
 /// <returns></returns>
 /// <include file='EntityQueryExtensions.Examples.xml' path='//Class[@name="EntityQueryExtensions"]/method[@name="OrderBy"]/*' />
 public static EntityQuery <TSource> OrderBy <TSource, TKey>(this EntityQuery <TSource> source, Expression <Func <TSource, TKey> > keySelector)
 {
     return((EntityQuery <TSource>)Queryable.OrderBy(source, keySelector));
 }
 /// <summary>
 /// Filters a sequence of values based on a predicate.
 /// </summary>
 /// <typeparam name="TSource"></typeparam>
 /// <param name="source1"></param>
 /// <param name="predicate"></param>
 /// <returns></returns>
 /// <include file='EntityQueryExtensions.Examples.xml' path='//Class[@name="EntityQueryExtensions"]/method[@name="Where1"]/*' />
 public static EntityQuery <TSource> Where <TSource>(this EntityQuery <TSource> source1, Expression <Func <TSource, bool> > predicate)
 {
     return((EntityQuery <TSource>)Queryable.Where(source1, predicate));
 }
 /// <summary>
 /// Returns a specified number of contiguous elements from the start of a sequence.
 /// </summary>
 /// <typeparam name="TSource"></typeparam>
 /// <param name="source"></param>
 /// <param name="count"></param>
 /// <returns></returns>
 /// <include file='EntityQueryExtensions.Examples.xml' path='//Class[@name="EntityQueryExtensions"]/method[@name="Skip2"]/*' />
 public static EntityQuery <TSource> Take <TSource>(this EntityQuery <TSource> source, int count)
 {
     return((EntityQuery <TSource>)Queryable.Take(source, count));
 }
示例#8
0
 /// <summary>
 /// May be called by subclasses that need to add additional behavior to a query.
 /// The basic idea is to use this method to clone the query first and then add
 /// or modify properties on the cloned instance.
 /// </summary>
 /// <param name="query"></param>
 protected EntityQuery(EntityQuery <T> query) : base(query)
 {
     DataServiceQuery = query.DataServiceQuery;
 }