Métodos LINQ suportados e não suportados (LINQ to Entities)
Esta seção fornece informações sobre os operadores de consulta padrão LINQ (Language-Integrated Query) com ou sem suporte nas consultas LINQ to Entities. Muitos dos operadores de consulta padrão LINQ têm uma versão sobrecarregada que aceita um argumento inteiro. O argumento inteiro corresponde a um índice baseado em zero na sequência em que está sendo operado, um IEqualityComparer<T>, ou IComparer<T>. A menos que especificado de outra forma, essas versões sobrecarregadas dos operadores de consulta padrão do LINQ não são suportadas, e tentar usá-las gerará uma exceção.
Métodos de projeção e restrição
A maioria dos métodos de projeção e restrição do LINQ são suportados nas consultas LINQ to Entities, com exceção daqueles que aceitam um argumento posicional. Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de projeção e restrição com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
Select | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 ) |
Métodos de Adesão
Os métodos de junção LINQ são suportados no LINQ to Entities, com exceção daqueles que aceitam um IEqualityComparer
porque o comparador não pode ser traduzido para a fonte de dados. Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de associação com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
GroupJoin | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 ) |
Definir Métodos
A maioria dos métodos do conjunto LINQ é suportada em consultas LINQ to Entities, com exceção daqueles que usam um EqualityComparer<T>arquivo . Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de conjunto com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
All | Suportado | 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 | Suportado | Function Any(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Boolean |
bool Any<TSource>( this IQueryable<TSource> source ) |
Any | Suportado | 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 | Suportado | Function Contains(Of TSource) ( _ source As IQueryable(Of TSource), _ item As TSource _ ) As Boolean |
bool Contains<TSource>( this IQueryable<TSource> source, TSource item ) |
Contains | Não suportado | 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 | Suportado, mas não há garantia de preservação da ordem |
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 | Suportado | Function DefaultIfEmpty(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> DefaultIfEmpty<TSource>( this IQueryable<TSource> source ) |
DefaultIfEmpty | Suportado | 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 | Suportado | Function Distinct(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Distinct<TSource>( this IQueryable<TSource> source ) |
Distinct | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 ) |
Métodos de encomenda
A maioria dos métodos de ordenação LINQ são suportados no LINQ to Entities, com exceção daqueles que aceitam um IComparer<T>, porque o comparador não pode ser traduzido para a fonte de dados. Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de ordenação suportados e não suportados.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
OrderBy | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Não suportado | Function Reverse(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) |
IQueryable<TSource> Reverse<TSource>( this IQueryable<TSource> source ) |
Métodos de agrupamento
A maioria dos métodos de agrupamento LINQ são suportados no LINQ to Entities, com exceção daqueles que aceitam um IEqualityComparer<T>, porque o comparador não pode ser traduzido para a fonte de dados. Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de agrupamento com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
GroupBy | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Não suportado | 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 ) |
Métodos de agregação
A maioria dos métodos agregados que aceitam tipos de dados primitivos são suportados no LINQ to Entities. Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de agregação com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
Aggregate | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Suportado | Function Average ( _ source As IQueryable(Of Decimal) _ ) As Decimal |
decimal Average( this IQueryable<decimal> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Double) _ ) As Double |
double Average( this IQueryable<double> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Integer) _ ) As Double |
double Average( this IQueryable<int> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Long) _ ) As Double |
double Average( this IQueryable<long> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Nullable(Of Decimal)) _ ) As Nullable(Of Decimal) |
Nullable<decimal> Average( this IQueryable<Nullable<decimal>> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Nullable(Of Double)) _ ) As Nullable(Of Double) |
Nullable<double> Average( this IQueryable<Nullable<double>> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Nullable(Of Integer)) _ ) As Nullable(Of Double) |
Nullable<double> Average( this IQueryable<Nullable<int>> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Nullable(Of Long)) _ ) As Nullable(Of Double) |
Nullable<double> Average( this IQueryable<Nullable<long>> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Nullable(Of Single)) _ ) As Nullable(Of Single) |
Nullable<float> Average( this IQueryable<Nullable<float>> source ) |
Average | Suportado | Function Average ( _ source As IQueryable(Of Single) _ ) As Single |
float Average( this IQueryable<float> source ) |
Average | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Suportado | Function Count(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Integer |
int Count<TSource>( this IQueryable<TSource> source ) |
Count | Não suportado | 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 | Suportado | Function LongCount(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Long |
long LongCount<TSource>( this IQueryable<TSource> source ) |
LongCount | Não suportado | 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 | Suportado | Function Max(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Max<TSource>( this IQueryable<TSource> source ) |
Max | Não suportado | 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 | Suportado | Function Min(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Min<TSource>( this IQueryable<TSource> source ) |
Min | Não suportado | 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 | Suportado | Function Sum ( _ source As IQueryable(Of Decimal) _ ) As Decimal |
decimal Sum( this IQueryable<decimal> source ) |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Double) _ ) As Double |
double Sum( this IQueryable<double> source |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Integer) _ ) As Integer |
int Sum( this IQueryable<int> source ) |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Long) _ ) As Long |
long Sum( this IQueryable<long> source ) |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Nullable(Of Decimal)) _ ) As Nullable(Of Decimal) |
Nullable<decimal> Sum( this IQueryable<Nullable<decimal>> source ) |
Sum | Suportado | 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 | Suportado | Function Sum ( _ source As IQueryable(Of Nullable(Of Integer)) _ ) As Nullable(Of Integer) |
Nullable<int> Sum( this IQueryable<Nullable<int>> source ) |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Nullable(Of Long)) _ ) As Nullable(Of Long) |
Nullable<long> Sum( this IQueryable<Nullable<long>> source ) |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Nullable(Of Single)) _ ) As Nullable(Of Single) |
Nullable<float> Sum( this IQueryable<Nullable<float>> source ) |
Sum | Suportado | Function Sum ( _ source As IQueryable(Of Single) _ ) As Single |
float Sum( this IQueryable<float> source ) |
Sum | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 | Não suportado | 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 ) |
Métodos de tipo
Os operadores de consulta padrão LINQ que lidam com conversão e teste de tipo CLR são suportados no Entity Framework. Somente tipos CLR mapeados para tipos de modelo conceitual são suportados no LINQ to Entities. Para obter uma lista de tipos de modelos conceituais, consulte Tipos de modelo conceitual (CSDL). A tabela a seguir lista os métodos de tipo com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
Cast | Suportado para tipos primitivos EDM | Function Cast(Of TResult) ( _ source As IQueryable _ ) As IQueryable(Of TResult) |
IQueryable<TResult> Cast<TResult>( this IQueryable source ) |
OfType | Suportado para EntityType | Function OfType(Of TResult) ( _ source As IQueryable _ ) As IQueryable(Of TResult) |
IQueryable<TResult> OfType<TResult>( this IQueryable source ) |
Métodos de paginação
Vários dos métodos de paginação LINQ não são suportados nas consultas LINQ to Entities. Para obter mais informações, consulte Operadores de consulta padrão em consultas LINQ to Entities. A tabela a seguir lista os métodos de paginação com e sem suporte.
Método | Suporte | Assinatura de função do Visual Basic | Assinatura do método C# |
---|---|---|---|
ElementAt | Não suportado | Function ElementAt(Of TSource) ( _ source As IQueryable(Of TSource), _ index As Integer _ ) As TSource |
TSource ElementAt<TSource>( this IQueryable<TSource> source, int index ) |
ElementAtOrDefault | Não suportado | Function ElementAtOrDefault(Of TSource) ( _ source As IQueryable(Of TSource), _ index As Integer _ ) As TSource |
TSource ElementAtOrDefault<TSource>( this IQueryable<TSource> source, int index ) |
First | Suportado | Function First(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource First<TSource>( this IQueryable<TSource> source ) |
First | Suportado | 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 | Suportado | Function FirstOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource FirstOrDefault<TSource>( this IQueryable<TSource> source ) |
FirstOrDefault | Suportado | 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 | Não suportado | Function Last(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Last<TSource>( this IQueryable<TSource> source ) |
Last | Não suportado | 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 | Não suportado | Function LastOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource LastOrDefault<TSource>( this IQueryable<TSource> source ) |
LastOrDefault | Não suportado | 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 | Suportado | Function Single(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource Single<TSource>( this IQueryable<TSource> source ) |
Single | Suportado | 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 | Suportado | Function SingleOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource |
TSource SingleOrDefault<TSource>( this IQueryable<TSource> source ) |
SingleOrDefault | Suportado | 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 | Suportado | 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 | Não suportado | 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 | Não suportado | 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 | Suportado | 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 | Não suportado | 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 | Não suportado | 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 ) |