Condividi tramite


EntityFrameworkQueryableExtensions.ThenInclude Metodo

Definizione

Overload

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

Specifica altri dati correlati da includere ulteriormente in base a un tipo correlato appena incluso.

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

Specifica altri dati correlati da includere ulteriormente in base a un tipo correlato appena incluso.

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

Specifica altri dati correlati da includere ulteriormente in base a un tipo correlato appena incluso.

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

Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs

Specifica altri dati correlati da includere ulteriormente in base a un tipo correlato appena incluso.

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)

Parametri di tipo

TEntity

Tipo di entità sottoposta a query.

TPreviousProperty

Tipo dell'entità appena inclusa.

TProperty

Tipo dell'entità correlata da includere.

Parametri

source
IIncludableQueryable<TEntity,TPreviousProperty>

Query di origine.

navigationPropertyPath
Expression<Func<TPreviousProperty,TProperty>>

Espressione lambda che rappresenta la proprietà di spostamento da includere (t => t.Property1).

Restituisce

Nuova query con i dati correlati inclusi.

Esempio

La query seguente mostra un singolo livello di entità correlate:

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

La query seguente mostra due livelli di entità nello stesso ramo:

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

La query seguente mostra più livelli e rami di dati correlati:

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

La query seguente mostra due livelli di entità nello stesso ramo, secondo in base al tipo derivato:

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

La query seguente mostra due livelli di entità nello stesso ramo, secondo in base al tipo derivato usando il metodo alternativo.

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

Commenti

Per altre informazioni ed esempi, vedere Caricamento di entità correlate .

Si applica a

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

Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs
Origine:
EntityFrameworkQueryableExtensions.cs

Specifica altri dati correlati da includere ulteriormente in base a un tipo correlato appena incluso.

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)

Parametri di tipo

TEntity

Tipo di entità sottoposta a query.

TPreviousProperty

Tipo dell'entità appena inclusa.

TProperty

Tipo dell'entità correlata da includere.

Parametri

source
IIncludableQueryable<TEntity,IEnumerable<TPreviousProperty>>

Query di origine.

navigationPropertyPath
Expression<Func<TPreviousProperty,TProperty>>

Espressione lambda che rappresenta la proprietà di spostamento da includere (t => t.Property1).

Restituisce

Nuova query con i dati correlati inclusi.

Esempio

La query seguente mostra un singolo livello di entità correlate:

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

La query seguente mostra due livelli di entità nello stesso ramo:

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

La query seguente mostra più livelli e rami di dati correlati:

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

La query seguente mostra due livelli di entità nello stesso ramo, seconda entità nel tipo derivato usando il cast:

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

La query seguente mostra due livelli di entità nello stesso ramo, secondo in base al tipo derivato usando l'operatore as .

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

Commenti

Per altre informazioni ed esempi, vedere Caricamento di entità correlate .

Si applica a

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

Specifica altri dati correlati da includere ulteriormente in base a un tipo correlato appena incluso.

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)

Parametri di tipo

TEntity

Tipo di entità sottoposta a query.

TPreviousProperty

Tipo dell'entità appena inclusa.

TProperty

Tipo dell'entità correlata da includere.

Parametri

source
IIncludableQueryable<TEntity,ICollection<TPreviousProperty>>

Query di origine.

navigationPropertyPath
Expression<Func<TPreviousProperty,TProperty>>

Espressione lambda che rappresenta la proprietà di spostamento da includere (t => t.Property1).

Restituisce

Nuova query con i dati correlati inclusi.

Esempio

La query seguente mostra un singolo livello di entità correlate.

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

La query seguente mostra due livelli di entità nello stesso ramo.

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

La query seguente mostra più livelli e rami di dati correlati.

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

Si applica a