Поддерживаемые и неподдерживаемые методы LINQ (LINQ to Entities)
В этом разделе содержатся сведения о стандартных операторах запросов,интегрированных с языком (LINQ), поддерживаемых или неподдерживаемых в запросах LINQ to Entity. У многих стандартных операторов запросов LINQ существуют перегруженные версии, принимающие целочисленный аргумент. Целочисленный аргумент соответствует отсчитываемой от нуля индексу последовательности, с которой выполняется работа, или IEqualityComparer<T>IComparer<T>. Если не указано обратное, эти перегруженные версии стандартных операторов LINQ не поддерживаются и при попытке их использования будет вызвано исключение.
Методы проекции и ограничения
Большинство методов проекции и ограничений LINQ поддерживаются в запросах LINQ to Entity, за исключением тех, которые принимают позиционный аргумент. Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице приведены поддерживаемые и неподдерживаемые методы проекций и ограничений.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
Select | Поддерживается | Function Select(Of TSource, TResult) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> Select<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector ) |
Select | Не поддерживается | Function Select(Of TSource, TResult) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Integer, TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> Select<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector ) |
SelectMany | Поддерживается | Function SelectMany(Of TSource, TResult) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, IEnumerable(Of TResult))) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> SelectMany<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TResult>>> selector ) |
SelectMany | Не поддерживается | Function SelectMany(Of TSource, TResult) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Integer, IEnumerable(Of TResult))) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> SelectMany<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, int, IEnumerable<TResult>>> selector ) |
SelectMany | Поддерживается | Function SelectMany(Of TSource, TCollection, TResult) ( _ source As IQueryable(Of TSource), _ collectionSelector As Expression(Of Func(Of TSource, IEnumerable(Of TCollection))), _ resultSelector As Expression(Of Func(Of TSource, TCollection, TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> SelectMany\<TSource, TCollection, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector, Expression<Func\<TSource, TCollection, TResult>> resultSelector ) |
SelectMany | Не поддерживается | Function SelectMany(Of TSource, TCollection, TResult) ( _ source As IQueryable(Of TSource), _ collectionSelector As Expression(Of Func(Of TSource, Integer, IEnumerable(Of TCollection))), _ resultSelector As Expression(Of Func(Of TSource, TCollection, TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> SelectMany\<TSource, TCollection, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector, Expression<Func\<TSource, TCollection, TResult>> resultSelector ) |
Where | Поддерживается | Function Where(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Where<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Where | Не поддерживается | Function Where(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Integer, Boolean)) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Where<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, int, bool>> predicate ) |
Методы соединения
Методы соединения LINQ поддерживаются в сущностях LINQ to Entities, за исключением тех, которые принимают IEqualityComparer
, так как средство сравнения не может быть преобразовано в источник данных. Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице перечислены поддерживаемые и неподдерживаемые методы соединения.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
GroupJoin | Поддерживается | Function GroupJoin(Of TOuter, TInner, TKey, TResult) ( _ outer As IQueryable(Of TOuter), _ inner As IEnumerable(Of TInner), _ outerKeySelector As Expression(Of Func(Of TOuter, TKey)), _ innerKeySelector As Expression(Of Func(Of TInner, TKey)), _ resultSelector As Expression(Of Func(Of TOuter, IEnumerable(Of TInner), TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>( this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector ) |
GroupJoin | Не поддерживается | Function GroupJoin(Of TOuter, TInner, TKey, TResult) ( _ outer As IQueryable(Of TOuter), _ inner As IEnumerable(Of TInner), _ outerKeySelector As Expression(Of Func(Of TOuter, TKey)), _ innerKeySelector As Expression(Of Func(Of TInner, TKey)), _ resultSelector As Expression(Of Func(Of TOuter, IEnumerable(Of TInner), TResult)), _ comparer As IEqualityComparer(Of TKey) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> GroupJoin\<TOuter, TInner, TKey, TResult>( this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func\<TOuter, TKey>> outerKeySelector, Expression<Func\<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector, IEqualityComparer<TKey> comparer ) |
Join | Поддерживается | Function Join(Of TOuter, TInner, TKey, TResult) ( _ outer As IQueryable(Of TOuter), _ inner As IEnumerable(Of TInner), _ outerKeySelector As Expression(Of Func(Of TOuter, TKey)), _ innerKeySelector As Expression(Of Func(Of TInner, TKey)), _ resultSelector As Expression(Of Func(Of TOuter, TInner, TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>( this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector ) |
Join | Не поддерживается | Function Join(Of TOuter, TInner, TKey, TResult) ( _ outer As IQueryable(Of TOuter), _ inner As IEnumerable(Of TInner), _ outerKeySelector As Expression(Of Func(Of TOuter, TKey)), _ innerKeySelector As Expression(Of Func(Of TInner, TKey)), _ resultSelector As Expression(Of Func(Of TOuter, TInner, TResult)), _ comparer As IEqualityComparer(Of TKey) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> Join\<TOuter, TInner, TKey, TResult>( this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func\<TOuter, TKey>> outerKeySelector, Expression<Func\<TInner, TKey>> innerKeySelector, Expression<Func\<TOuter, TInner, TResult>> resultSelector, IEqualityComparer<TKey> comparer ) |
Задать методы
Большинство методов набора LINQ поддерживаются в запросах LINQ to Entity, за исключением тех, которые используют .EqualityComparer<T> Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице перечисляются поддерживаемые и неподдерживаемые методы работы с наборами.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
All | Поддерживается | Function All(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As Boolean |
bool All<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Any | Поддерживаемые | Function Any(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Boolean |
bool Any<TSource>( this IQueryable<TSource> source ) |
Any | Поддерживаемые | Function Any(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As Boolean |
bool Any<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Contains | Поддерживается | Function Contains(Of TSource) ( _ source As IQueryable(Of TSource), _ item As TSource _ ) As Boolean |
bool Contains<TSource>( this IQueryable<TSource> source, TSource item ) |
Contains | Не поддерживается | Function Contains(Of TSource) ( _ source As IQueryable(Of TSource), _ item As TSource, _ comparer As IEqualityComparer(Of TSource) _ ) As Boolean |
bool Contains<TSource>( this IQueryable<TSource> source, TSource item, IEqualityComparer<TSource> comparer ) |
Concat | Поддерживается, но не гарантируется сохранение порядка |
Function Concat(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Concat<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2 ) |
DefaultIfEmpty | Поддерживается | Function DefaultIfEmpty(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> DefaultIfEmpty<TSource>( this IQueryable<TSource> source ) |
DefaultIfEmpty | Поддерживаемые | Function DefaultIfEmpty(Of TSource) ( _ source As IQueryable(Of TSource), _ defaultValue As TSource _ ) As IQueryable(Of TSource) |
IQueryable<TSource> DefaultIfEmpty<TSource>( this IQueryable<TSource> source, TSource defaultValue ) |
Distinct | Поддерживается | Function Distinct(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Distinct<TSource>( this IQueryable<TSource> source ) |
Distinct | Не поддерживается | Function Distinct(Of TSource) ( _ source As IQueryable(Of TSource), _ comparer As IEqualityComparer(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Distinct<TSource>( this IQueryable<TSource> source, IEqualityComparer<TSource> comparer ) |
Except | Поддерживается | Function Except(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Except<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2 ) |
Except | Не поддерживается | Function Except(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource), _ comparer As IEqualityComparer(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Except<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer ) |
Intersect | Поддерживается | Function Intersect(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Intersect<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2 ) |
Intersect | Не поддерживается | Function Intersect(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource), _ comparer As IEqualityComparer(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Intersect<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer ) |
Union | Поддерживается | Function Union(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Union<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2 ) |
Union | Не поддерживается | Function Union(Of TSource) ( _ source1 As IQueryable(Of TSource), _ source2 As IEnumerable(Of TSource), _ comparer As IEqualityComparer(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Union<TSource>( this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer ) |
Методы упорядочивания
Большинство методов упорядочения LINQ поддерживаются в сущностях LINQ to Entities, за исключением тех, которые принимают IComparer<T>значение, так как средство сравнения не может быть переведено в источник данных. Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице перечислены поддерживаемые и неподдерживаемые методы упорядочения.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
OrderBy | Поддерживается | Function OrderBy(Of TSource, TKey) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> OrderBy<TSource, TKey>( this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector ) |
OrderBy | Не поддерживается | Function OrderBy(Of TSource, TKey) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ comparer As IComparer(Of TKey) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> OrderBy\<TSource, TKey>( this IQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, IComparer<TKey> comparer ) |
OrderByDescending | Поддерживается | Function OrderByDescending(Of TSource, TKey) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>( this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector ) |
OrderByDescending | Не поддерживается | Function OrderByDescending(Of TSource, TKey) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ comparer As IComparer(Of TKey) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> OrderByDescending\<TSource, TKey>( this IQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, IComparer<TKey> comparer ) |
ThenBy | Поддерживается | Function ThenBy(Of TSource, TKey) ( _ source As IOrderedQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> ThenBy<TSource, TKey>( this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector ) |
ThenBy | Не поддерживается | Function ThenBy(Of TSource, TKey) ( _ source As IOrderedQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ comparer As IComparer(Of TKey) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> ThenBy\<TSource, TKey>( this IOrderedQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, IComparer<TKey> comparer ) |
ThenByDescending | Поддерживается | Function ThenByDescending(Of TSource, TKey) ( _ source As IOrderedQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>( this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector ) |
ThenByDescending | Не поддерживается | Function ThenByDescending(Of TSource, TKey) ( _ source As IOrderedQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ comparer As IComparer(Of TKey) _ ) As IOrderedQueryable(Of TSource) |
IOrderedQueryable<TSource> ThenByDescending\<TSource, TKey>( this IOrderedQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, IComparer<TKey> comparer ) |
Reverse | Не поддерживается | Function Reverse(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Reverse<TSource>( this IQueryable<TSource> source ) |
Методы группирования
Большинство методов группировки LINQ поддерживаются в сущностях LINQ to Entities, за исключением тех, которые принимают IEqualityComparer<T>, так как средство сравнения не может быть переведено в источник данных. Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице перечислены поддерживаемые и неподдерживаемые методы группирования.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
GroupBy | Поддерживается | Function GroupBy(Of TSource, TKey) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)) _ ) As IQueryable(Of IGrouping(Of TKey, TSource)) |
IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>( this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector ) |
GroupBy | Не поддерживается | Function GroupBy(Of TSource, TKey) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ comparer As IEqualityComparer(Of TKey) _ ) As IQueryable(Of IGrouping(Of TKey, TSource)) |
IQueryable<IGrouping\<TKey, TSource>> GroupBy\<TSource, TKey>( this IQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer ) |
GroupBy | Поддерживается | Function GroupBy(Of TSource, TKey, TElement) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ elementSelector As Expression(Of Func(Of TSource, TElement)) _ ) As IQueryable(Of IGrouping(Of TKey, TElement)) |
IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>( this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector ) |
GroupBy | Поддерживается | Function GroupBy(Of TSource, TKey, TResult) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ resultSelector As Expression(Of Func(Of TKey, IEnumerable(Of TSource), TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> GroupBy\<TSource, TKey, TResult>( this IQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector ) |
GroupBy | Не поддерживается | Function GroupBy(Of TSource, TKey, TElement) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ elementSelector As Expression(Of Func(Of TSource, TElement)), _ comparer As IEqualityComparer(Of TKey) _ ) As IQueryable(Of IGrouping(Of TKey, TElement)) |
IQueryable<IGrouping\<TKey, TElement>> GroupBy\<TSource, TKey, TElement>( this IQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, Expression<Func\<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer |
GroupBy | Поддерживается | Function GroupBy(Of TSource, TKey, TElement, TResult) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ elementSelector As Expression(Of Func(Of TSource, TElement)), _ resultSelector As Expression(Of Func(Of TKey, IEnumerable(Of TElement), TResult)) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector ) |
GroupBy | Не поддерживается | Function GroupBy(Of TSource, TKey, TResult) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ resultSelector As Expression(Of Func(Of TKey, IEnumerable(Of TSource), TResult)), _ comparer As IEqualityComparer(Of TKey) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> GroupBy\<TSource, TKey, TResult>( this IQueryable<TSource> source, Expression<Func\<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector, IEqualityComparer<TKey> comparer ) |
GroupBy | Не поддерживается | Function GroupBy(Of TSource, TKey, TElement, TResult) ( _ source As IQueryable(Of TSource), _ keySelector As Expression(Of Func(Of TSource, TKey)), _ elementSelector As Expression(Of Func(Of TSource, TElement)), _ resultSelector As Expression(Of Func(Of TKey, IEnumerable(Of TElement), TResult)), _ comparer As IEqualityComparer(Of TKey) _ ) As IQueryable(Of TResult) |
IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector, IEqualityComparer<TKey> comparer ) |
Методы статистической обработки
Большинство агрегатных методов, которые принимают примитивные типы данных, поддерживаются в сущностях LINQ to Entities. Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице перечислены поддерживаемые и неподдерживаемые статистические методы.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
Aggregate | Не поддерживается | Function Aggregate(Of TSource) ( _ source As IQueryable(Of TSource), _ func As Expression(Of Func(Of TSource, TSource, TSource)) _ ) As TSource |
TSource Aggregate<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, TSource, TSource>> func ) |
Aggregate | Не поддерживается | Function Aggregate(Of TSource, TAccumulate) ( _ source As IQueryable(Of TSource), _ seed As TAccumulate, _ func As Expression(Of Func(Of TAccumulate, TSource, TAccumulate)) _ ) As TAccumulate |
TAccumulate Aggregate<TSource, TAccumulate>( this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func ) |
Aggregate | Не поддерживается | Function Aggregate(Of TSource, TAccumulate, TResult) ( _ source As IQueryable(Of TSource), _ seed As TAccumulate, _ func As Expression(Of Func(Of TAccumulate, TSource, TAccumulate)), _ selector As Expression(Of Func(Of TAccumulate, TResult)) _ ) As TResult |
TResult Aggregate<TSource, TAccumulate, TResult>( this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func, Expression<Func<TAccumulate, TResult>> selector ) |
Average | Поддерживается | Function Average ( _ source As IQueryable(Of Decimal) _ ) As Decimal |
decimal Average( this IQueryable<decimal> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Double) _ ) As Double |
double Average( this IQueryable<double> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Integer) _ ) As Double |
double Average( this IQueryable<int> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Long) _ ) As Double |
double Average( this IQueryable<long> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Nullable(Of Decimal)) _ ) As Nullable(Of Decimal) |
Nullable<decimal> Average( this IQueryable<Nullable<decimal>> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Nullable(Of Double)) _ ) As Nullable(Of Double) |
Nullable<double> Average( this IQueryable<Nullable<double>> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Nullable(Of Integer)) _ ) As Nullable(Of Double) |
Nullable<double> Average( this IQueryable<Nullable<int>> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Nullable(Of Long)) _ ) As Nullable(Of Double) |
Nullable<double> Average( this IQueryable<Nullable<long>> source ) |
Average | Поддерживаемые | Function Average ( _ source As IQueryable(Of Nullable(Of Single)) _ ) As Nullable(Of Single) |
Nullable<float> Average( this IQueryable<Nullable<float>> source ) |
Average | Поддерживается | Function Average ( _ source As IQueryable(Of Single) _ ) As Single |
float Average( this IQueryable<float> source ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Integer)) _ ) As Double |
double Average<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, int>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Integer))) _ ) As Nullable(Of Double) |
Nullable<double> Average<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<int>>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Long)) _ ) As Double |
double Average<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, long>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Long))) _ ) As Nullable(Of Double) |
Nullable<double> Average<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<long>>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Single)) _ ) As Single |
float Average<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, float>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Single))) _ ) As Nullable(Of Single) |
Nullable<float> Average<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<float>>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Double)) _ ) As Double |
double Average<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, double>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Double))) _ ) As Nullable(Of Double) |
Nullable<double> Average<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<double>>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Decimal)) _ ) As Decimal |
decimal Average<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, decimal>> selector ) |
Average | Не поддерживается | Function Average(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Decimal))) _ ) As Nullable(Of Decimal) |
Nullable<decimal> Average<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<decimal>>> selector ) |
Count | Поддерживается | Function Count(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Integer |
int Count<TSource>( this IQueryable<TSource> source ) |
Count | Не поддерживается | Function Count(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As Integer |
int Count<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
LongCount | Поддерживается | Function LongCount(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Long |
long LongCount<TSource>( this IQueryable<TSource> source ) |
LongCount | Не поддерживается | Function LongCount(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As Long |
long LongCount<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Max | Поддерживается | Function Max(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Max<TSource>( this IQueryable<TSource> source ) |
Max | Не поддерживается | Function Max(Of TSource, TResult) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, TResult)) _ ) As TResult |
TResult Max<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector ) |
Min | Поддерживается | Function Min(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Min<TSource>( this IQueryable<TSource> source ) |
Min | Не поддерживается | Function Min(Of TSource, TResult) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, TResult)) _ ) As TResult |
TResult Min<TSource, TResult>( this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector ) |
Sum | Поддерживается | Function Sum ( _ source As IQueryable(Of Decimal) _ ) As Decimal |
decimal Sum( this IQueryable<decimal> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Double) _ ) As Double |
double Sum( this IQueryable<double> source |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Integer) _ ) As Integer |
int Sum( this IQueryable<int> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Long) _ ) As Long |
long Sum( this IQueryable<long> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Nullable(Of Decimal)) _ ) As Nullable(Of Decimal) |
Nullable<decimal> Sum( this IQueryable<Nullable<decimal>> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Nullable(Of Double)) _ ) As Nullable(Of Double) |
Function Sum ( _ source As IQueryable(Of Nullable(Of Double)) _ ) As Nullable(Of Double)Nullable<double> Sum( this IQueryable<Nullable<double>> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Nullable(Of Integer)) _ ) As Nullable(Of Integer) |
Nullable<int> Sum( this IQueryable<Nullable<int>> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Nullable(Of Long)) _ ) As Nullable(Of Long) |
Nullable<long> Sum( this IQueryable<Nullable<long>> source ) |
Sum | Поддерживаемые | Function Sum ( _ source As IQueryable(Of Nullable(Of Single)) _ ) As Nullable(Of Single) |
Nullable<float> Sum( this IQueryable<Nullable<float>> source ) |
Sum | Поддерживается | Function Sum ( _ source As IQueryable(Of Single) _ ) As Single |
float Sum( this IQueryable<float> source ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Integer)) _ ) As Integer |
int Sum<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, int>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Integer))) _ ) As Nullable(Of Integer) |
Nullable<int> Sum<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<int>>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Long)) _ ) As Long |
long Sum<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, long>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Long))) _ ) As Nullable(Of Long) |
Nullable<long> Sum<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<long>>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Single))) _ ) As Nullable(Of Single) |
Nullable<float> Sum<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<float>>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Single)) _ ) As Single |
float Sum<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, float>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Double)) _ ) As Double |
double Sum<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, double>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Double))) _ ) As Nullable(Of Double) |
Nullable<double> Sum<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<double>>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Decimal)) _ ) As Decimal |
decimal Sum<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, decimal>> selector ) |
Sum | Не поддерживается | Function Sum(Of TSource) ( _ source As IQueryable(Of TSource), _ selector As Expression(Of Func(Of TSource, Nullable(Of Decimal))) _ ) As Nullable(Of Decimal) |
Nullable<decimal> Sum<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<decimal>>> selector ) |
Методы типов
Стандартные операторы запросов LINQ, которые работают с преобразованием и тестированием типов CLR, поддерживаются в Entity Framework. В языке LINQ to Entities поддерживаются только те типы CLR, которые сопоставляются с типами концептуальной модели. Список типов концептуальных моделей см. в разделе "Концептуальные типы моделей" (CSDL). В следующей таблице перечислены поддерживаемые и неподдерживаемые методы типа.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
Cast | Поддерживается для типов-примитивов модели EDM | Function Cast(Of TResult) ( _ source As IQueryable _ ) As IQueryable(Of TResult) |
IQueryable<TResult> Cast<TResult>( this IQueryable source ) |
OfType | Поддерживается для объекта EntityType | Function OfType(Of TResult) ( _ source As IQueryable _ ) As IQueryable(Of TResult) |
IQueryable<TResult> OfType<TResult>( this IQueryable source ) |
Методы постраничного просмотра
Ряд методов разбиения по страницам LINQ не поддерживаются в запросах LINQ to Entity. Дополнительные сведения см. в разделе "Стандартные операторы запросов" в запросах LINQ to Entity. В следующей таблице перечисляются поддерживаемые и неподдерживаемые методы постраничного просмотра.
Способ | Поддержка | Сигнатура функции Visual Basic | Сигнатура метода C# |
---|---|---|---|
ElementAt | Не поддерживается | Function ElementAt(Of TSource) ( _ source As IQueryable(Of TSource), _ index As Integer _ ) As TSource |
TSource ElementAt<TSource>( this IQueryable<TSource> source, int index ) |
ElementAtOrDefault | Не поддерживается | Function ElementAtOrDefault(Of TSource) ( _ source As IQueryable(Of TSource), _ index As Integer _ ) As TSource |
TSource ElementAtOrDefault<TSource>( this IQueryable<TSource> source, int index ) |
First | Поддерживается | Function First(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource First<TSource>( this IQueryable<TSource> source ) |
First | Поддерживаемые | Function First(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As TSource |
TSource First<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
FirstOrDefault | Поддерживаемые | Function FirstOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource FirstOrDefault<TSource>( this IQueryable<TSource> source ) |
FirstOrDefault | Поддерживается | Function FirstOrDefault(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As TSource |
TSource FirstOrDefault<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Last | Не поддерживается | Function Last(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Last<TSource>( this IQueryable<TSource> source ) |
Last | Не поддерживается | Function Last(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As TSource |
TSource Last<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
LastOrDefault | Не поддерживается | Function LastOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource LastOrDefault<TSource>( this IQueryable<TSource> source ) |
LastOrDefault | Не поддерживается | Function LastOrDefault(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As TSource |
TSource LastOrDefault<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Single | Поддерживается | Function Single(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Single<TSource>( this IQueryable<TSource> source ) |
Single | Поддерживаемые | Function Single(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As TSource |
TSource Single<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
SingleOrDefault | Поддерживаемые | Function SingleOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource SingleOrDefault<TSource>( this IQueryable<TSource> source ) |
SingleOrDefault | Поддерживаемые | Function SingleOrDefault(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As TSource |
TSource SingleOrDefault<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
Skip | Поддерживается | Function Skip(Of TSource) ( _ source As IQueryable(Of TSource), _ count As Integer _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Skip<TSource>( this IQueryable<TSource> source, int count ) |
SkipWhile | Не поддерживается | Function SkipWhile(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> SkipWhile<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
SkipWhile | Не поддерживается | Function SkipWhile(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Integer, Boolean)) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> SkipWhile<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, int, bool>> predicate ) |
Take | Поддерживается | Function Take(Of TSource) ( _ source As IQueryable(Of TSource), _ count As Integer _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Take<TSource>( this IQueryable<TSource> source, int count ) |
TakeWhile | Не поддерживается | Function TakeWhile(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Boolean)) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> TakeWhile<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, bool>> predicate ) |
TakeWhile | Не поддерживается | Function TakeWhile(Of TSource) ( _ source As IQueryable(Of TSource), _ predicate As Expression(Of Func(Of TSource, Integer, Boolean)) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> TakeWhile<TSource>( this IQueryable<TSource> source, Expression<Func\<TSource, int, bool>> predicate ) |