Class IncludeExtensions
Eager loading of child navigations in the style of EF Core's Include/ThenInclude: GraphQL
linked tables (lnk*) and nested tables (tbl*). A nested table has no key variant —
the nesting scopes it — so only the plain .Include(x => x.Nav) form applies to it; the
on/via/handle overloads below are link-only. For links, the key variant is chosen per call:
- join condition — index (
by*) and parent binding (using*) are inferred:.Include(a => a.PostalAddresses, (a, pa) => pa.AdrNr == a.AdrNr && pa.AnsNr == a.ReAnsNr) - index initializer — explicit index, binding from the assignments:
.Include(a => a.PostalAddresses, a => new PostalAddressesAdrNrAnsNrIdx { AdrNr = a.AdrNr, AnsNr = a.ReAnsNr }) - none — the navigation's default variant (all related rows).
public static class IncludeExtensions
- Inheritance
-
objectIncludeExtensions
Methods
Include<T, TChild>(IQueryable<T>, Expression<Func<T, IEnumerable<TChild>?>>)
Includes a nested navigation exposed as IEnumerable<T>.
public static IIncludableQueryable<T, IEnumerable<TChild>?> Include<T, TChild>(this IQueryable<T> source, Expression<Func<T, IEnumerable<TChild>?>> navigation) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new()
Parameters
sourceIQueryable<T>The source query.
navigationExpression<Func<T, IEnumerable<TChild>>>The nested navigation to load (
x => x.Nav).
Returns
- IIncludableQueryable<T, IEnumerable<TChild>>
Type Parameters
TTChild
Include<T, TChild>(IQueryable<T>, Expression<Func<T, List<TChild>?>>)
Includes a link navigation using its default key variant (all related rows).
public static IIncludableQueryable<T, List<TChild>?> Include<T, TChild>(this IQueryable<T> source, Expression<Func<T, List<TChild>?>> navigation) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new()
Parameters
sourceIQueryable<T>The source query.
navigationExpression<Func<T, List<TChild>>>The link navigation to load (
x => x.Nav).
Returns
- IIncludableQueryable<T, List<TChild>>
Type Parameters
TTChild
Include<T, TChild>(IQueryable<T>, Expression<Func<T, List<TChild>?>>, Expression<Func<T, TChild, bool>>)
Includes a link navigation; the key variant is inferred from a join condition between the parent row and the linked row.
public static IIncludableQueryable<T, List<TChild>?> Include<T, TChild>(this IQueryable<T> source, Expression<Func<T, List<TChild>?>> navigation, Expression<Func<T, TChild, bool>> on) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new()
Parameters
sourceIQueryable<T>The source query.
navigationExpression<Func<T, List<TChild>>>The link navigation to load (
x => x.Nav).onExpression<Func<T, TChild, bool>>Join condition, e.g.
(a, pa) => pa.AdrNr == a.AdrNr && pa.AnsNr == a.ReAnsNr.
Returns
- IIncludableQueryable<T, List<TChild>>
Type Parameters
TTChild
Include<T, TChild>(IQueryable<T>, Expression<Func<T, List<TChild>?>>, Expression<Func<T, TChild, bool>>, out LinkHandle<TChild>)
Includes a link navigation via join condition and returns a typed handle for reading the loaded rows (Linked<TChild>(LinkHandle<TChild>)). Use handles to load several key variants of the same navigation in one query — the navigation property itself only holds the rows of the first include.
public static IIncludableQueryable<T, List<TChild>?> Include<T, TChild>(this IQueryable<T> source, Expression<Func<T, List<TChild>?>> navigation, Expression<Func<T, TChild, bool>> on, out LinkHandle<TChild> handle) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new()
Parameters
sourceIQueryable<T>The source query.
navigationExpression<Func<T, List<TChild>>>The link navigation to load (
x => x.Nav).onExpression<Func<T, TChild, bool>>Join condition, e.g.
(a, pa) => pa.AdrNr == a.AdrNr && pa.AnsNr == a.ReAnsNr.handleLinkHandle<TChild>Handle of this include's link variant.
Returns
- IIncludableQueryable<T, List<TChild>>
Type Parameters
TTChild
Include<T, TChild, TIndex>(IQueryable<T>, Expression<Func<T, List<TChild>?>>, Expression<Func<T, TIndex>>)
Includes a link navigation; the key variant is chosen explicitly by initializing the linked table's index with parent fields.
public static IIncludableQueryable<T, List<TChild>?> Include<T, TChild, TIndex>(this IQueryable<T> source, Expression<Func<T, List<TChild>?>> navigation, Expression<Func<T, TIndex>> via) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new() where TIndex : IDataSetIndex
Parameters
sourceIQueryable<T>The source query.
navigationExpression<Func<T, List<TChild>>>The link navigation to load (
x => x.Nav).viaExpression<Func<T, TIndex>>Index initializer, e.g.
a => new PostalAddressesAdrNrAnsNrIdx { AdrNr = a.AdrNr, AnsNr = a.ReAnsNr }.
Returns
- IIncludableQueryable<T, List<TChild>>
Type Parameters
TTChildTIndex
Include<T, TChild, TIndex>(IQueryable<T>, Expression<Func<T, List<TChild>?>>, Expression<Func<T, TIndex>>, out LinkHandle<TChild>)
Includes a link navigation via index initializer and returns a typed handle for reading the loaded rows.
public static IIncludableQueryable<T, List<TChild>?> Include<T, TChild, TIndex>(this IQueryable<T> source, Expression<Func<T, List<TChild>?>> navigation, Expression<Func<T, TIndex>> via, out LinkHandle<TChild> handle) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new() where TIndex : IDataSetIndex
Parameters
sourceIQueryable<T>The source query.
navigationExpression<Func<T, List<TChild>>>The link navigation to load (
x => x.Nav).viaExpression<Func<T, TIndex>>Index initializer, e.g.
a => new PostalAddressesAdrNrAnsNrIdx { AdrNr = a.AdrNr, AnsNr = a.ReAnsNr }.handleLinkHandle<TChild>Handle of this include's link variant.
Returns
- IIncludableQueryable<T, List<TChild>>
Type Parameters
TTChildTIndex
ThenInclude<T, TPrev, TNext>(IIncludableQueryable<T, IEnumerable<TPrev>?>, Expression<Func<TPrev, IEnumerable<TNext>?>>)
Includes a further nested navigation exposed as IEnumerable<T>.
public static IIncludableQueryable<T, IEnumerable<TNext>?> ThenInclude<T, TPrev, TNext>(this IIncludableQueryable<T, IEnumerable<TPrev>?> source, Expression<Func<TPrev, IEnumerable<TNext>?>> navigation) where T : IDataSetEntity, new() where TPrev : IDataSetEntity, new() where TNext : IDataSetEntity, new()
Parameters
sourceIIncludableQueryable<T, IEnumerable<TPrev>>The source query with a pending include.
navigationExpression<Func<TPrev, IEnumerable<TNext>>>The nested navigation to load below the previous one.
Returns
- IIncludableQueryable<T, IEnumerable<TNext>>
Type Parameters
TTPrevTNext
ThenInclude<T, TPrev, TNext>(IIncludableQueryable<T, IEnumerable<TPrev>?>, Expression<Func<TPrev, List<TNext>?>>)
Includes a further link navigation below the previously included one, using its default key variant.
public static IIncludableQueryable<T, List<TNext>?> ThenInclude<T, TPrev, TNext>(this IIncludableQueryable<T, IEnumerable<TPrev>?> source, Expression<Func<TPrev, List<TNext>?>> navigation) where T : IDataSetEntity, new() where TPrev : IDataSetEntity, new() where TNext : IDataSetEntity, new()
Parameters
sourceIIncludableQueryable<T, IEnumerable<TPrev>>The source query with a pending include.
navigationExpression<Func<TPrev, List<TNext>>>The link navigation to load below the previous one.
Returns
- IIncludableQueryable<T, List<TNext>>
Type Parameters
TTPrevTNext
ThenInclude<T, TPrev, TNext>(IIncludableQueryable<T, IEnumerable<TPrev>?>, Expression<Func<TPrev, List<TNext>?>>, Expression<Func<TPrev, TNext, bool>>)
Includes a further link navigation below the previously included one; the key variant is inferred from a join condition between the previous row and the linked row.
public static IIncludableQueryable<T, List<TNext>?> ThenInclude<T, TPrev, TNext>(this IIncludableQueryable<T, IEnumerable<TPrev>?> source, Expression<Func<TPrev, List<TNext>?>> navigation, Expression<Func<TPrev, TNext, bool>> on) where T : IDataSetEntity, new() where TPrev : IDataSetEntity, new() where TNext : IDataSetEntity, new()
Parameters
sourceIIncludableQueryable<T, IEnumerable<TPrev>>The source query with a pending include.
navigationExpression<Func<TPrev, List<TNext>>>The link navigation to load below the previous one.
onExpression<Func<TPrev, TNext, bool>>Join condition, e.g.
(pa, cp) => cp.AdrNr == pa.AdrNr.
Returns
- IIncludableQueryable<T, List<TNext>>
Type Parameters
TTPrevTNext
ThenInclude<T, TPrev, TNext>(IIncludableQueryable<T, IEnumerable<TPrev>?>, Expression<Func<TPrev, List<TNext>?>>, Expression<Func<TPrev, TNext, bool>>, out LinkHandle<TNext>)
Includes a further link navigation below the previously included one via join condition and returns a typed handle for reading the loaded rows.
public static IIncludableQueryable<T, List<TNext>?> ThenInclude<T, TPrev, TNext>(this IIncludableQueryable<T, IEnumerable<TPrev>?> source, Expression<Func<TPrev, List<TNext>?>> navigation, Expression<Func<TPrev, TNext, bool>> on, out LinkHandle<TNext> handle) where T : IDataSetEntity, new() where TPrev : IDataSetEntity, new() where TNext : IDataSetEntity, new()
Parameters
sourceIIncludableQueryable<T, IEnumerable<TPrev>>The source query with a pending include.
navigationExpression<Func<TPrev, List<TNext>>>The link navigation to load below the previous one.
onExpression<Func<TPrev, TNext, bool>>Join condition, e.g.
(pa, cp) => cp.AdrNr == pa.AdrNr.handleLinkHandle<TNext>Handle of this include's link variant.
Returns
- IIncludableQueryable<T, List<TNext>>
Type Parameters
TTPrevTNext
ThenInclude<T, TPrev, TNext, TIndex>(IIncludableQueryable<T, IEnumerable<TPrev>?>, Expression<Func<TPrev, List<TNext>?>>, Expression<Func<TPrev, TIndex>>)
Includes a further link navigation below the previously included one; the key variant is chosen explicitly by initializing the linked table's index with fields of the previous row.
public static IIncludableQueryable<T, List<TNext>?> ThenInclude<T, TPrev, TNext, TIndex>(this IIncludableQueryable<T, IEnumerable<TPrev>?> source, Expression<Func<TPrev, List<TNext>?>> navigation, Expression<Func<TPrev, TIndex>> via) where T : IDataSetEntity, new() where TPrev : IDataSetEntity, new() where TNext : IDataSetEntity, new() where TIndex : IDataSetIndex
Parameters
sourceIIncludableQueryable<T, IEnumerable<TPrev>>The source query with a pending include.
navigationExpression<Func<TPrev, List<TNext>>>The link navigation to load below the previous one.
viaExpression<Func<TPrev, TIndex>>Index initializer over the previous row's fields.
Returns
- IIncludableQueryable<T, List<TNext>>
Type Parameters
TTPrevTNextTIndex
ThenInclude<T, TPrev, TNext, TIndex>(IIncludableQueryable<T, IEnumerable<TPrev>?>, Expression<Func<TPrev, List<TNext>?>>, Expression<Func<TPrev, TIndex>>, out LinkHandle<TNext>)
Includes a further link navigation below the previously included one via index initializer and returns a typed handle for reading the loaded rows.
public static IIncludableQueryable<T, List<TNext>?> ThenInclude<T, TPrev, TNext, TIndex>(this IIncludableQueryable<T, IEnumerable<TPrev>?> source, Expression<Func<TPrev, List<TNext>?>> navigation, Expression<Func<TPrev, TIndex>> via, out LinkHandle<TNext> handle) where T : IDataSetEntity, new() where TPrev : IDataSetEntity, new() where TNext : IDataSetEntity, new() where TIndex : IDataSetIndex
Parameters
sourceIIncludableQueryable<T, IEnumerable<TPrev>>The source query with a pending include.
navigationExpression<Func<TPrev, List<TNext>>>The link navigation to load below the previous one.
viaExpression<Func<TPrev, TIndex>>Index initializer over the previous row's fields.
handleLinkHandle<TNext>Handle of this include's link variant.
Returns
- IIncludableQueryable<T, List<TNext>>
Type Parameters
TTPrevTNextTIndex
WithFields<T, TChild>(IIncludableQueryable<T, List<TChild>?>, Expression<Func<TChild, object?>>)
Narrows the fields fetched for the previously included navigation — a fetch limit like
the root-level includes: unselected fields keep their defaults, the identifier is
always fetched. Chain directly after the Include/ThenInclude it applies to.
public static IIncludableQueryable<T, List<TChild>?> WithFields<T, TChild>(this IIncludableQueryable<T, List<TChild>?> source, Expression<Func<TChild, object?>> fields) where T : IDataSetEntity, new() where TChild : IDataSetEntity, new()
Parameters
sourceIIncludableQueryable<T, List<TChild>>The source query with a pending include.
fieldsExpression<Func<TChild, object>>Field selector, e.g.
pa => new { pa.AnsNr, pa.Na1 }.
Returns
- IIncludableQueryable<T, List<TChild>>
Type Parameters
TTChild