EntityFrameworkQueryableExtensions.ThenInclude Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Overload
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity,TPreviousProperty>, Expression<Func<TPreviousProperty,TProperty>>) |
Menentukan data terkait tambahan untuk disertakan lebih lanjut berdasarkan jenis terkait yang baru saja disertakan. |
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>) |
Menentukan data terkait tambahan untuk disertakan lebih lanjut berdasarkan jenis terkait yang baru saja disertakan. |
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, ICollection<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>) |
Menentukan data terkait tambahan untuk disertakan lebih lanjut berdasarkan jenis terkait yang baru saja disertakan. |
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity,TPreviousProperty>, Expression<Func<TPreviousProperty,TProperty>>)
Menentukan data terkait tambahan untuk disertakan lebih lanjut berdasarkan jenis terkait yang baru saja disertakan.
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)
Jenis parameter
- TEntity
Jenis entitas yang sedang dikueri.
- TPreviousProperty
Jenis entitas yang baru saja disertakan.
- TProperty
Jenis entitas terkait yang akan disertakan.
Parameter
- source
- IIncludableQueryable<TEntity,TPreviousProperty>
Kueri sumber.
- navigationPropertyPath
- Expression<Func<TPreviousProperty,TProperty>>
Ekspresi lambda yang mewakili properti navigasi yang akan disertakan (t => t.Property1
).
Mengembalikan
Kueri baru dengan data terkait disertakan.
Contoh
Kueri berikut ini memperlihatkan termasuk satu tingkat entitas terkait:
context.Blogs.Include(blog => blog.Posts)
Kueri berikut ini memperlihatkan termasuk dua tingkat entitas pada cabang yang sama:
context.Blogs.Include(blog => blog.Posts).ThenInclude(post => post.Tags)
Kueri berikut ini memperlihatkan termasuk beberapa tingkatan dan cabang data terkait:
context.Blogs
.Include(blog => blog.Posts).ThenInclude(post => post.Tags).ThenInclude(tag => tag.TagInfo)
.Include(blog => blog.Contributors)
Kueri berikut ini memperlihatkan termasuk dua tingkat entitas pada cabang yang sama, yang kedua berada pada jenis turunan:
context.Blogs.Include(blog => blog.Posts).ThenInclude(post => ((SpecialPost)post).SpecialTags)
Kueri berikut menunjukkan termasuk dua tingkat entitas pada cabang yang sama, yang kedua berada pada jenis turunan menggunakan metode alternatif.
context.Blogs.Include(blog => blog.Posts).ThenInclude(post => (post as SpecialPost).SpecialTags)
Keterangan
Lihat Memuat entitas terkait untuk informasi dan contoh selengkapnya.
Berlaku untuk
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)
Menentukan data terkait tambahan untuk disertakan lebih lanjut berdasarkan jenis terkait yang baru saja disertakan.
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)
Jenis parameter
- TEntity
Jenis entitas yang sedang dikueri.
- TPreviousProperty
Jenis entitas yang baru saja disertakan.
- TProperty
Jenis entitas terkait yang akan disertakan.
Parameter
- source
- IIncludableQueryable<TEntity,IEnumerable<TPreviousProperty>>
Kueri sumber.
- navigationPropertyPath
- Expression<Func<TPreviousProperty,TProperty>>
Ekspresi lambda yang mewakili properti navigasi yang akan disertakan (t => t.Property1
).
Mengembalikan
Kueri baru dengan data terkait disertakan.
Contoh
Kueri berikut ini memperlihatkan termasuk satu tingkat entitas terkait:
context.Blogs.Include(blog => blog.Posts)
Kueri berikut ini memperlihatkan termasuk dua tingkat entitas pada cabang yang sama:
context.Blogs
.Include(blog => blog.Posts).ThenInclude(post => post.Tags)
Kueri berikut ini memperlihatkan termasuk beberapa tingkatan dan cabang data terkait:
context.Blogs
.Include(blog => blog.Posts).ThenInclude(post => post.Tags).ThenInclude(tag => tag.TagInfo)
.Include(blog => blog.Contributors)
Kueri berikut ini memperlihatkan termasuk dua tingkat entitas pada cabang yang sama, yang kedua berada pada jenis turunan menggunakan transmisi:
context.Blogs.Include(blog => blog.Posts).ThenInclude(post => ((SpecialPost)post).SpecialTags)
Kueri berikut menunjukkan termasuk dua tingkat entitas pada cabang yang sama, yang kedua berada pada jenis turunan as
menggunakan operator.
context.Blogs.Include(blog => blog.Posts).ThenInclude(post => (post as SpecialPost).SpecialTags)
Keterangan
Lihat Memuat entitas terkait untuk informasi dan contoh selengkapnya.
Berlaku untuk
ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, ICollection<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)
Menentukan data terkait tambahan untuk disertakan lebih lanjut berdasarkan jenis terkait yang baru saja disertakan.
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)
Jenis parameter
- TEntity
Jenis entitas yang sedang dikueri.
- TPreviousProperty
Jenis entitas yang baru saja disertakan.
- TProperty
Jenis entitas terkait yang akan disertakan.
Parameter
- source
- IIncludableQueryable<TEntity,ICollection<TPreviousProperty>>
Kueri sumber.
- navigationPropertyPath
- Expression<Func<TPreviousProperty,TProperty>>
Ekspresi lambda yang mewakili properti navigasi yang akan disertakan (t => t.Property1
).
Mengembalikan
Kueri baru dengan data terkait disertakan.
Contoh
Kueri berikut ini memperlihatkan termasuk satu tingkat entitas terkait.
context.Blogs.Include(blog => blog.Posts);
Kueri berikut ini memperlihatkan termasuk dua tingkat entitas pada cabang yang sama.
context.Blogs
.Include(blog => blog.Posts).ThenInclude(post => post.Tags);
Kueri berikut ini memperlihatkan termasuk beberapa tingkatan dan cabang data terkait.
context.Blogs
.Include(blog => blog.Posts).ThenInclude(post => post.Tags).ThenInclude(tag => tag.TagInfo)
.Include(blog => blog.Contributors);
Berlaku untuk
Entity Framework