Condividi tramite


Metodi LINQ supportati e non supportati (LINQ to Entities)

In questa sezione vengono fornite informazioni sugli operatori di query standard LINQ (Language Integrated Query) supportati o non supportati nelle query LINQ to Entities . Numerosi operatori di query standard LINQ dispongono di una versione di overload che accetta un argomento integer. L'argomento integer corrisponde a un indice in base zero nella sequenza che si sta utilizzando, un oggetto IEqualityComparer o un oggetto IComparer. Se non specificato diversamente, queste versioni di overload degli operatori di query standard LINQ non sono supportate e quando si tenta di utilizzarle viene generata un'eccezione.

Metodi di proiezione e di restrizione

La maggior parte dei metodi di proiezione e di restrizione LINQ è supportata nelle query LINQ to Entities , fatta eccezione per i metodi che accettano un argomento posizionale. Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi di proiezione e di restrizione supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

Select

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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
)

Metodi join

I metodi join LINQ sono supportati in LINQ to Entities , fatta eccezione per i metodi che accettano un oggetto IEqualityComparer, in quanto l'operatore di confronto non può essere convertito nell'origine dati. Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi join supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

GroupJoin

Supportato

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

Non supportato

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

Supportato

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

Non supportato

 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
)

Metodi Set

La maggior parte dei metodi Set LINQ è supportata nelle query LINQ to Entities , fatta eccezione per i metodi che utilizzano un oggetto EqualityComparer. Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi Set supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

All

Supportato

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

Supportato

Function Any(Of TSource) ( _
source As IQueryable(Of TSource) _
) As Boolean
bool Any<TSource>(
this IQueryable<TSource> source
)

Any

Supportato

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

Supportato

Function Contains(Of TSource) ( _
source As IQueryable(Of TSource), _
item As TSource _
) As Boolean
bool Contains<TSource>(
this IQueryable<TSource> source,
TSource item
)

Contains

Non supportato

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

Supportato, ma nessuna garanzia

di ordine mantenuto

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

Supportato

Function DefaultIfEmpty(Of TSource) ( _
source As IQueryable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> DefaultIfEmpty<TSource>(
this IQueryable<TSource> source
)

DefaultIfEmpty

Supportato

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

Supportato

Function Distinct(Of TSource) ( _
source As IQueryable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Distinct<TSource>(
this IQueryable<TSource> source
)

Distinct

Non supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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
)

Metodi di ordinamento

La maggior parte dei metodi di ordinamento LINQ è supportata in LINQ to Entities , fatta eccezione per i metodi che accettano un oggetto IComparer, in quanto l'operatore di confronto non può essere convertito nell'origine dati. Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi di ordinamento supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

OrderBy

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Non supportato

Function Reverse(Of TSource) ( _
source As IQueryable(Of TSource) _
) As IQueryable(Of TSource)
IQueryable<TSource> Reverse<TSource>(
this IQueryable<TSource> source
)

Metodi di raggruppamento

La maggior parte dei metodi di raggruppamento LINQ è supportata in LINQ to Entities , fatta eccezione per i metodi che accettano un oggetto IEqualityComparer, in quanto l'operatore di confronto non può essere convertito nell'origine dati. Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi di raggruppamento supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

GroupBy

Supportato

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

Non supportato

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

Supportato

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

Supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Non supportato

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
)

Metodi di aggregazione

In LINQ to Entities è supportata la maggior parte dei metodi di aggregazione che accettano tipi di dati primitivi. Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi di aggregazione supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

Aggregate

Non supportato

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

Non supportato

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

Non supportato

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

Supportato

Function Average ( _
source As IQueryable(Of Decimal) _
) As Decimal
decimal Average(
this IQueryable<decimal> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Double) _
) As Double
double Average(
this IQueryable<double> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Integer) _
) As Double
double Average(
this IQueryable<int> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Long) _
) As Double
double Average(
this IQueryable<long> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Nullable(Of Decimal)) _
) As Nullable(Of Decimal)
Nullable<decimal> Average(
this IQueryable<Nullable<decimal>> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Nullable(Of Double)) _
) As Nullable(Of Double)
Nullable<double> Average(
this IQueryable<Nullable<double>> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Nullable(Of Integer)) _
) As Nullable(Of Double)
Nullable<double> Average(
this IQueryable<Nullable<int>> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Nullable(Of Long)) _
) As Nullable(Of Double)
Nullable<double> Average(
this IQueryable<Nullable<long>> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Nullable(Of Single)) _
) As Nullable(Of Single)
Nullable<float> Average(
this IQueryable<Nullable<float>> source
)

Average

Supportato

Function Average ( _
source As IQueryable(Of Single) _
) As Single
float Average(
this IQueryable<float> source
)

Average

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Supportato

Function Count(Of TSource) ( _
source As IQueryable(Of TSource) _
) As Integer
int Count<TSource>(
this IQueryable<TSource> source
)

Count

Non supportato

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

Supportato

Function LongCount(Of TSource) ( _
source As IQueryable(Of TSource) _
) As Long
long LongCount<TSource>(
this IQueryable<TSource> source
)

LongCount

Non supportato

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

Supportato

Function Max(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Max<TSource>(
this IQueryable<TSource> source
)

Max

Non supportato

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

Supportato

Function Min(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Min<TSource>(
this IQueryable<TSource> source
)

Min

Non supportato

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

Supportato

Function Sum ( _
source As IQueryable(Of Decimal) _
) As Decimal
decimal Sum(
this IQueryable<decimal> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Double) _
) As Double
double Sum(
this IQueryable<double> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Integer) _
) As Integer
int Sum(
this IQueryable<int> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Long) _
) As Long
long Sum(
this IQueryable<long> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Nullable(Of Decimal)) _
) As Nullable(Of Decimal)
Nullable<decimal> Sum(
this IQueryable<Nullable<decimal>> source
)

Sum

Supportato

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

Supportato

Function Sum ( _
source As IQueryable(Of Nullable(Of Integer)) _
) As Nullable(Of Integer)
Nullable<int> Sum(
this IQueryable<Nullable<int>> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Nullable(Of Long)) _
) As Nullable(Of Long)
Nullable<long> Sum(
this IQueryable<Nullable<long>> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Nullable(Of Single)) _
) As Nullable(Of Single)
Nullable<float> Sum(
this IQueryable<Nullable<float>> source
)

Sum

Supportato

Function Sum ( _
source As IQueryable(Of Single) _
) As Single
float Sum(
this IQueryable<float> source
)

Sum

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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

Non supportato

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
)

Metodi di tipo

Gli operatori di query standard LINQ che gestiscono i test e la conversione dei tipi CLR sono supportati in Entity Framework . Solo i tipi CLR mappati ai tipi del modello concettuale sono supportati in LINQ to Entities. Per un elenco dei tipi del modello concettuale, vedere Tipi del modello concettuale. Nella tabella seguente sono elencati i metodi di tipo supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

Cast

Supportato per i tipi primitivi EDM

Function Cast(Of TResult) ( _
source As IQueryable _
) As IQueryable(Of TResult)
IQueryable<TResult> Cast<TResult>(
this IQueryable source
)

OfType

Supportato per EntityType

Function OfType(Of TResult) ( _
source As IQueryable _
) As IQueryable(Of TResult)
IQueryable<TResult> OfType<TResult>(
this IQueryable source
)

Metodi di paging

Alcuni metodi di paging LINQ non sono supportati nelle query LINQ to Entities . Per ulteriori informazioni, vedere Operatori di query standard nelle query LINQ to Entities. Nella tabella seguente sono elencati i metodi di paging supportati e non supportati.

Metodo Supporto Firma della funzione Visual Basic Firma del metodo C#

ElementAt

Non supportato

Function ElementAt(Of TSource) ( _
source As IQueryable(Of TSource), _
index As Integer _
) As TSource
TSource ElementAt<TSource>(
this IQueryable<TSource> source,
int index
)

ElementAtOrDefault

Non supportato

Function ElementAtOrDefault(Of TSource) ( _
source As IQueryable(Of TSource), _
index As Integer _
) As TSource
TSource ElementAtOrDefault<TSource>(
this IQueryable<TSource> source,
int index
)

First

Supportato

Function First(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource First<TSource>(
this IQueryable<TSource> source
)

First

Supportato

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

Supportato

Function FirstOrDefault(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource FirstOrDefault<TSource>(
this IQueryable<TSource> source
)

FirstOrDefault

Supportato

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

Non supportato

Function Last(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Last<TSource>(
this IQueryable<TSource> source
)

Last

Non supportato

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

Non supportato

Function LastOrDefault(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource LastOrDefault<TSource>(
this IQueryable<TSource> source
)

LastOrDefault

Non supportato

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

Supportato

Function Single(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Single<TSource>(
this IQueryable<TSource> source
)

Single

Supportato

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

Supportato

Function SingleOrDefault(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource SingleOrDefault<TSource>(
this IQueryable<TSource> source
)

SingleOrDefault

Supportato

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

Supportato

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

Non supportato

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

Non supportato

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

Supportato

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

Non supportato

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

Non supportato

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
)

Vedere anche

Concetti

Operatori di query standard nelle query LINQ to Entities