Language

EntityFrameworkQueryableExtensions.ThenInclude メソッド

定義

オーバーロード

Name 説明
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)

追加の関連データを、含めたばかりの関連する型に基づいてさらに含めるよう指定します。

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity,TPreviousProperty>, Expression<Func<TPreviousProperty,TProperty>>)

追加の関連データを、含めたばかりの関連する型に基づいてさらに含めるよう指定します。

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, ICollection<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)

追加の関連データを、含めたばかりの関連する型に基づいてさらに含めるよう指定します。

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)

ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs

追加の関連データを、含めたばかりの関連する型に基づいてさらに含めるよう指定します。

public static Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<TEntity,TProperty> ThenInclude<TEntity,TPreviousProperty,TProperty>(this Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<TEntity,System.Collections.Generic.IEnumerable<TPreviousProperty>> source, System.Linq.Expressions.Expression<Func<TPreviousProperty,TProperty>> navigationPropertyPath) where TEntity : class;
static member ThenInclude : Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<'Entity, seq<'PreviousProperty> (requires 'Entity : null)> * System.Linq.Expressions.Expression<Func<'PreviousProperty, 'Property>> -> Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<'Entity, 'Property (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function ThenInclude(Of TEntity As Class, TPreviousProperty As Class, TProperty As Class) (source As IIncludableQueryable(Of TEntity, IEnumerable(Of TPreviousProperty)), navigationPropertyPath As Expression(Of Func(Of TPreviousProperty, TProperty))) As IIncludableQueryable(Of TEntity, TProperty)

型パラメーター

TEntity

クエリを実行するエンティティの種類。

TPreviousProperty

含まれたエンティティの型。

TProperty

含める関連エンティティの型。

パラメーター

source
IIncludableQueryable<TEntity,IEnumerable<TPreviousProperty>>

ソース クエリです。

navigationPropertyPath
Expression<Func<TPreviousProperty,TProperty>>

含めるナビゲーション プロパティを表すラムダ式 (t => t.Property1)。

戻り値

関連データが含まれる新しいクエリ。

例

次のクエリは、単一レベルの関連エンティティを含めて示しています。

context.Blogs.Include(blog => blog.Posts)

次のクエリは、同じブランチに 2 つのレベルのエンティティを含めて示しています。

context.Blogs
   .Include(blog => blog.Posts).ThenInclude(post => post.Tags)

次のクエリは、関連データの複数のレベルと分岐を含めて示しています。

context.Blogs
   .Include(blog => blog.Posts).ThenInclude(post => post.Tags).ThenInclude(tag => tag.TagInfo)
   .Include(blog => blog.Contributors)

次のクエリは、同じブランチ上の 2 つのレベルのエンティティを含み、2 つ目はキャストを使用して派生型上にあるエンティティを示しています。

context.Blogs.Include(blog => blog.Posts).ThenInclude(post => ((SpecialPost)post).SpecialTags)

次のクエリは、同じ分岐に 2 つのレベルのエンティティを含め、2 つ目は as 演算子を使用して派生型上にあるエンティティを示しています。

context.Blogs.Include(blog => blog.Posts).ThenInclude(post => (post as SpecialPost).SpecialTags)

注釈

詳細と例については、「 関連エンティティの読み込み」 を参照してください。

適用対象

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity,TPreviousProperty>, Expression<Func<TPreviousProperty,TProperty>>)

ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs
ソース:
EntityFrameworkQueryableExtensions.cs

追加の関連データを、含めたばかりの関連する型に基づいてさらに含めるよう指定します。

public static Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<TEntity,TProperty> ThenInclude<TEntity,TPreviousProperty,TProperty>(this Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<TEntity,TPreviousProperty> source, System.Linq.Expressions.Expression<Func<TPreviousProperty,TProperty>> navigationPropertyPath) where TEntity : class;
static member ThenInclude : Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<'Entity, 'PreviousProperty (requires 'Entity : null)> * System.Linq.Expressions.Expression<Func<'PreviousProperty, 'Property>> -> Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<'Entity, 'Property (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function ThenInclude(Of TEntity As Class, TPreviousProperty As Class, TProperty As Class) (source As IIncludableQueryable(Of TEntity, TPreviousProperty), navigationPropertyPath As Expression(Of Func(Of TPreviousProperty, TProperty))) As IIncludableQueryable(Of TEntity, TProperty)

型パラメーター

TEntity

クエリを実行するエンティティの種類。

TPreviousProperty

含まれたエンティティの型。

TProperty

含める関連エンティティの型。

パラメーター

source
IIncludableQueryable<TEntity,TPreviousProperty>

ソース クエリです。

navigationPropertyPath
Expression<Func<TPreviousProperty,TProperty>>

含めるナビゲーション プロパティを表すラムダ式 (t => t.Property1)。

戻り値

関連データが含まれる新しいクエリ。

例

次のクエリは、単一レベルの関連エンティティを含めて示しています。

context.Blogs.Include(blog => blog.Posts)

次のクエリは、同じブランチに 2 つのレベルのエンティティを含めて示しています。

context.Blogs.Include(blog => blog.Posts).ThenInclude(post => post.Tags)

次のクエリは、関連データの複数のレベルと分岐を含めて示しています。

context.Blogs
   .Include(blog => blog.Posts).ThenInclude(post => post.Tags).ThenInclude(tag => tag.TagInfo)
   .Include(blog => blog.Contributors)

次のクエリは、同じブランチ上の 2 つのレベルのエンティティを含み、2 つ目は派生型に存在するエンティティを示しています。

context.Blogs.Include(blog => blog.Posts).ThenInclude(post => ((SpecialPost)post).SpecialTags)

次のクエリは、同じブランチ上の 2 つのレベルのエンティティを含み、2 つ目は別のメソッドを使用して派生型上にあるエンティティを示しています。

context.Blogs.Include(blog => blog.Posts).ThenInclude(post => (post as SpecialPost).SpecialTags)

注釈

詳細と例については、「 関連エンティティの読み込み」 を参照してください。

適用対象

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, ICollection<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)

追加の関連データを、含めたばかりの関連する型に基づいてさらに含めるよう指定します。

public static Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<TEntity,TProperty> ThenInclude<TEntity,TPreviousProperty,TProperty>(this Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<TEntity,System.Collections.Generic.ICollection<TPreviousProperty>> source, System.Linq.Expressions.Expression<Func<TPreviousProperty,TProperty>> navigationPropertyPath) where TEntity : class;
static member ThenInclude : Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<'Entity, System.Collections.Generic.ICollection<'PreviousProperty> (requires 'Entity : null)> * System.Linq.Expressions.Expression<Func<'PreviousProperty, 'Property>> -> Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<'Entity, 'Property (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function ThenInclude(Of TEntity As Class, TPreviousProperty As Class, TProperty As Class) (source As IIncludableQueryable(Of TEntity, ICollection(Of TPreviousProperty)), navigationPropertyPath As Expression(Of Func(Of TPreviousProperty, TProperty))) As IIncludableQueryable(Of TEntity, TProperty)

型パラメーター

TEntity

クエリを実行するエンティティの種類。

TPreviousProperty

含まれたエンティティの型。

TProperty

含める関連エンティティの型。

パラメーター

source
IIncludableQueryable<TEntity,ICollection<TPreviousProperty>>

ソース クエリです。

navigationPropertyPath
Expression<Func<TPreviousProperty,TProperty>>

含めるナビゲーション プロパティを表すラムダ式 (t => t.Property1)。

戻り値

関連データが含まれる新しいクエリ。

例

次のクエリは、1 つのレベルの関連エンティティを含める方法を示しています。

context.Blogs.Include(blog => blog.Posts);

次のクエリは、同じブランチに 2 つのレベルのエンティティを含めて示しています。

context.Blogs
    .Include(blog => blog.Posts).ThenInclude(post => post.Tags);

次のクエリは、関連データの複数のレベルと分岐を含めて示しています。

context.Blogs
    .Include(blog => blog.Posts).ThenInclude(post => post.Tags).ThenInclude(tag => tag.TagInfo)
    .Include(blog => blog.Contributors);

適用対象