サポート対象の LINQ メソッドとサポート非対象の LINQ メソッド (LINQ to Entities)Supported and Unsupported LINQ Methods (LINQ to Entities)

このセクションでは、統合言語クエリ (LINQ) 標準クエリ演算子がサポートまたはエンティティのクエリを LINQ でサポートされていないいるについてを説明します。This section provides information about the Language-Integrated Query (LINQ) standard query operators that are supported or unsupported in LINQ to Entities queries. LINQ 標準クエリ演算子の多くには、整数の引数を取るオーバーロード バージョンがあります。Many of the LINQ standard query operators have an overloaded version that accepts an integer argument. 整数の引数は、操作されるシーケンス内の 0 から始まるインデックスに対応するIEqualityComparer<T>、またはIComparer<T>します。The integer argument corresponds to a zero-based index in the sequence that is being operated on, an IEqualityComparer<T>, or IComparer<T>. 特に指定がなければ、LINQ 標準クエリ演算子のオーバーロード バージョンはサポートされず、このバージョンを使用しようとすると例外がスローされます。Unless otherwise specified, these overloaded versions of the LINQ standard query operators are not supported, and attempting to use them will throw an exception.

投影メソッドと制限メソッドProjection and Restriction Methods

ほとんどの LINQ 投影および制限メソッドは、位置引数を受け入れるものは例外のエンティティのクエリを LINQ でサポートされます。Most of the LINQ projection and restriction methods are supported in LINQ to Entities queries, with the exception of those that accept a positional argument. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象およびサポート非対象の投影および制限メソッドを示します。The following table lists the supported and unsupported projection and restriction methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
Select サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 )

結合メソッドJoin Methods

LINQ 結合メソッドが受け入れるものを除く LINQ to Entities でサポートされている、 IEqualityComparer comparer はデータ ソースに変換できないためです。The LINQ join methods are supported in LINQ to Entities, with the exception of those that accept an IEqualityComparer because the comparer cannot be translated to the data source. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象の結合メソッドとサポート非対象の結合メソッドを示します。The following table lists the supported and unsupported join methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
GroupJoin サポート状況Supported 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 サポート非対象Not Supported 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 サポート状況Supported 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 サポート非対象Not Supported 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 )

メソッドの設定Set Methods

ほとんどの LINQ セット メソッドがエンティティのクエリを使用するものは例外を LINQ でサポートされている、EqualityComparer<T>します。Most of the LINQ set methods are supported in LINQ to Entities queries, with the exception of those that use an EqualityComparer<T>. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象のセット メソッドとサポート非対象のセット メソッドを示します。The following table lists the supported and unsupported set methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
All サポート状況Supported 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 サポート状況Supported Function Any(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Boolean bool Any<TSource>( this IQueryable<TSource> source )
Any サポート状況Supported 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 サポート状況Supported Function Contains(Of TSource) ( _ source As IQueryable(Of TSource), _ item As TSource _ ) As Boolean bool Contains<TSource>( this IQueryable<TSource> source, TSource item )
Contains サポートなしNot supported 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 サポート対象だが、Supported, but there is no

順序の維持は保証されないguarantee of order being preserved
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 サポート状況Supported Function DefaultIfEmpty(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) IQueryable<TSource> DefaultIfEmpty<TSource>( this IQueryable<TSource> source )
DefaultIfEmpty サポート状況Supported 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 サポート状況Supported Function Distinct(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) IQueryable<TSource> Distinct<TSource>( this IQueryable<TSource> source )
Distinct サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 )

並べ替えメソッドOrdering Methods

LINQ 並べ替えメソッドのほとんどが受け入れるものは例外 LINQ to Entities でサポートされている、 IComparer<T>comparer はデータ ソースに変換できないためです。Most of the LINQ ordering methods are supported in LINQ to Entities, with the exception of those that accept an IComparer<T>, because the comparer cannot be translated to the data source. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象の並べ替えメソッドとサポート非対象の並べ替えメソッドを示します。The following table lists the supported and unsupported ordering methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
OrderBy サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポートなしNot supported Function Reverse(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As IQueryable(Of TSource) IQueryable<TSource> Reverse<TSource>( this IQueryable<TSource> source )

グループ化メソッドGrouping Methods

ほとんどの LINQ グループ化メソッドが受け入れるものは例外 LINQ to Entities でサポートされている、 IEqualityComparer<T>comparer はデータ ソースに変換できないためです。Most of the LINQ grouping methods are supported in LINQ to Entities, with the exception of those that accept an IEqualityComparer<T>, because the comparer cannot be translated to the data source. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象のグループ化メソッドとサポート非対象のグループ化メソッドを示します。The following table lists the supported and unsupported grouping methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
GroupBy サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポートなしNot supported 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 )

集計メソッドAggregate Methods

ほとんどのプリミティブ データ型を受け入れる集計メソッドは、LINQ to Entities でサポートされます。Most of the aggregate methods that accept primitive data types are supported in LINQ to Entities. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象の集計メソッドとサポート非対象の集計メソッドを示します。The following table lists the supported and unsupported aggregate methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
Aggregate サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポート状況Supported Function Average ( _ source As IQueryable(Of Decimal) _ ) As Decimal decimal Average( this IQueryable<decimal> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Double) _ ) As Double double Average( this IQueryable<double> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Integer) _ ) As Double double Average( this IQueryable<int> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Long) _ ) As Double double Average( this IQueryable<long> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Nullable(Of Decimal)) _ ) As Nullable(Of Decimal) Nullable<decimal> Average( this IQueryable<Nullable<decimal>> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Nullable(Of Double)) _ ) As Nullable(Of Double) Nullable<double> Average( this IQueryable<Nullable<double>> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Nullable(Of Integer)) _ ) As Nullable(Of Double) Nullable<double> Average( this IQueryable<Nullable<int>> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Nullable(Of Long)) _ ) As Nullable(Of Double) Nullable<double> Average( this IQueryable<Nullable<long>> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Nullable(Of Single)) _ ) As Nullable(Of Single) Nullable<float> Average( this IQueryable<Nullable<float>> source )
Average サポート状況Supported Function Average ( _ source As IQueryable(Of Single) _ ) As Single float Average( this IQueryable<float> source )
Average サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポート状況Supported Function Count(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Integer int Count<TSource>( this IQueryable<TSource> source )
Count サポートなしNot supported 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 サポート状況Supported Function LongCount(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As Long long LongCount<TSource>( this IQueryable<TSource> source )
LongCount サポートなしNot supported 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 サポート状況Supported Function Max(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource Max<TSource>( this IQueryable<TSource> source )
Max サポートなしNot supported 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 サポート状況Supported Function Min(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource Min<TSource>( this IQueryable<TSource> source )
Min サポートなしNot supported 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 サポート状況Supported Function Sum ( _ source As IQueryable(Of Decimal) _ ) As Decimal decimal Sum( this IQueryable<decimal> source )
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Double) _ ) As Double double Sum( this IQueryable<double> source
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Integer) _ ) As Integer int Sum( this IQueryable<int> source )
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Long) _ ) As Long long Sum( this IQueryable<long> source )
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Nullable(Of Decimal)) _ ) As Nullable(Of Decimal) Nullable<decimal> Sum( this IQueryable<Nullable<decimal>> source )
Sum サポート状況Supported 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 サポート状況Supported Function Sum ( _ source As IQueryable(Of Nullable(Of Integer)) _ ) As Nullable(Of Integer) Nullable<int> Sum( this IQueryable<Nullable<int>> source )
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Nullable(Of Long)) _ ) As Nullable(Of Long) Nullable<long> Sum( this IQueryable<Nullable<long>> source )
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Nullable(Of Single)) _ ) As Nullable(Of Single) Nullable<float> Sum( this IQueryable<Nullable<float>> source )
Sum サポート状況Supported Function Sum ( _ source As IQueryable(Of Single) _ ) As Single float Sum( this IQueryable<float> source )
Sum サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポートなしNot supported 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 )

型メソッドType Methods

CLR 型の変換とテストを処理する LINQ 標準クエリ演算子は、Entity Framework でサポートされます。The LINQ standard query operators that deal with CLR type conversion and testing are supported in the Entity Framework. LINQ to Entities では、概念モデルの型にマップする CLR 型のみがサポートされています。Only CLR types that map to conceptual model types are supported in LINQ to Entities. 概念モデルの型の一覧は、次を参照してください。概念モデルの型 (CSDL)します。For a list of conceptual model types, see Conceptual Model Types (CSDL). 次の表に、サポート対象の型メソッドとサポート非対象の型メソッドを示します。The following table lists the supported and unsupported type methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
Cast EDM プリミティブ型でサポートSupported for EDM primitive types Function Cast(Of TResult) ( _ source As IQueryable _ ) As IQueryable(Of TResult) IQueryable<TResult> Cast<TResult>( this IQueryable source )
OfType EntityType でサポートSupported for EntityType Function OfType(Of TResult) ( _ source As IQueryable _ ) As IQueryable(Of TResult) IQueryable<TResult> OfType<TResult>( this IQueryable source )

ページング メソッドPaging Methods

エンティティのクエリに、さまざまな LINQ ページング メソッドは LINQ でサポートされていません。A number of the LINQ paging methods are not supported in LINQ to Entities queries. 詳細については、次を参照してください。 LINQ to Entities クエリでの標準クエリ演算子します。For more information, see Standard Query Operators in LINQ to Entities Queries. 次の表に、サポート対象のページング メソッドとサポート非対象のページング メソッドを示します。The following table lists the supported and unsupported paging methods.

メソッドMethod SupportSupport Visual Basic 関数シグネチャVisual Basic function signature C# メソッド シグネチャC# method signature
ElementAt サポートなしNot supported Function ElementAt(Of TSource) ( _ source As IQueryable(Of TSource), _ index As Integer _ ) As TSource TSource ElementAt<TSource>( this IQueryable<TSource> source, int index )
ElementAtOrDefault サポートなしNot supported Function ElementAtOrDefault(Of TSource) ( _ source As IQueryable(Of TSource), _ index As Integer _ ) As TSource TSource ElementAtOrDefault<TSource>( this IQueryable<TSource> source, int index )
First サポート状況Supported Function First(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource First<TSource>( this IQueryable<TSource> source )
First サポート状況Supported 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 サポート状況Supported Function FirstOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource FirstOrDefault<TSource>( this IQueryable<TSource> source )
FirstOrDefault サポート状況Supported 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 サポートなしNot supported Function Last(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource Last<TSource>( this IQueryable<TSource> source )
Last サポートなしNot supported 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 サポートなしNot supported Function LastOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource LastOrDefault<TSource>( this IQueryable<TSource> source )
LastOrDefault サポートなしNot supported 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 サポート状況Supported Function Single(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource Single<TSource>( this IQueryable<TSource> source )
Single サポート状況Supported 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 サポート状況Supported Function SingleOrDefault(Of TSource) ( _ source As IQueryable(Of TSource) _ ) As TSource TSource SingleOrDefault<TSource>( this IQueryable<TSource> source )
SingleOrDefault サポート状況Supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポートなしNot supported 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 サポート状況Supported 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 サポートなしNot supported 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 サポートなしNot supported 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 )

関連項目See also