Table of Contents

Class IncludeExtensions

Namespace
BpNexT.NET.Queryable
Assembly
BpNexT.NET.Contracts.dll

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).
Arguments are validated at the call site; the calls ride the expression tree as markers that the executing provider extracts (currently GraphQL only — the COM backend rejects them). On non-BpNexT queryables (e.g. in-memory LINQ) Include is a no-op, like in EF Core. The validation and dispatch are provided by the BpNexT.NET runtime assembly.
public static class IncludeExtensions
Inheritance
object
IncludeExtensions

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

source IQueryable<T>

The source query.

navigation Expression<Func<T, IEnumerable<TChild>>>

The nested navigation to load (x => x.Nav).

Returns

IIncludableQueryable<T, IEnumerable<TChild>>

Type Parameters

T
TChild

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

source IQueryable<T>

The source query.

navigation Expression<Func<T, List<TChild>>>

The link navigation to load (x => x.Nav).

Returns

IIncludableQueryable<T, List<TChild>>

Type Parameters

T
TChild

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

source IQueryable<T>

The source query.

navigation Expression<Func<T, List<TChild>>>

The link navigation to load (x => x.Nav).

on Expression<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

T
TChild

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

source IQueryable<T>

The source query.

navigation Expression<Func<T, List<TChild>>>

The link navigation to load (x => x.Nav).

on Expression<Func<T, TChild, bool>>

Join condition, e.g. (a, pa) => pa.AdrNr == a.AdrNr && pa.AnsNr == a.ReAnsNr.

handle LinkHandle<TChild>

Handle of this include's link variant.

Returns

IIncludableQueryable<T, List<TChild>>

Type Parameters

T
TChild

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

source IQueryable<T>

The source query.

navigation Expression<Func<T, List<TChild>>>

The link navigation to load (x => x.Nav).

via Expression<Func<T, TIndex>>

Index initializer, e.g. a => new PostalAddressesAdrNrAnsNrIdx { AdrNr = a.AdrNr, AnsNr = a.ReAnsNr }.

Returns

IIncludableQueryable<T, List<TChild>>

Type Parameters

T
TChild
TIndex

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

source IQueryable<T>

The source query.

navigation Expression<Func<T, List<TChild>>>

The link navigation to load (x => x.Nav).

via Expression<Func<T, TIndex>>

Index initializer, e.g. a => new PostalAddressesAdrNrAnsNrIdx { AdrNr = a.AdrNr, AnsNr = a.ReAnsNr }.

handle LinkHandle<TChild>

Handle of this include's link variant.

Returns

IIncludableQueryable<T, List<TChild>>

Type Parameters

T
TChild
TIndex

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

source IIncludableQueryable<T, IEnumerable<TPrev>>

The source query with a pending include.

navigation Expression<Func<TPrev, IEnumerable<TNext>>>

The nested navigation to load below the previous one.

Returns

IIncludableQueryable<T, IEnumerable<TNext>>

Type Parameters

T
TPrev
TNext

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

source IIncludableQueryable<T, IEnumerable<TPrev>>

The source query with a pending include.

navigation Expression<Func<TPrev, List<TNext>>>

The link navigation to load below the previous one.

Returns

IIncludableQueryable<T, List<TNext>>

Type Parameters

T
TPrev
TNext

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

source IIncludableQueryable<T, IEnumerable<TPrev>>

The source query with a pending include.

navigation Expression<Func<TPrev, List<TNext>>>

The link navigation to load below the previous one.

on Expression<Func<TPrev, TNext, bool>>

Join condition, e.g. (pa, cp) => cp.AdrNr == pa.AdrNr.

Returns

IIncludableQueryable<T, List<TNext>>

Type Parameters

T
TPrev
TNext

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

source IIncludableQueryable<T, IEnumerable<TPrev>>

The source query with a pending include.

navigation Expression<Func<TPrev, List<TNext>>>

The link navigation to load below the previous one.

on Expression<Func<TPrev, TNext, bool>>

Join condition, e.g. (pa, cp) => cp.AdrNr == pa.AdrNr.

handle LinkHandle<TNext>

Handle of this include's link variant.

Returns

IIncludableQueryable<T, List<TNext>>

Type Parameters

T
TPrev
TNext

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

source IIncludableQueryable<T, IEnumerable<TPrev>>

The source query with a pending include.

navigation Expression<Func<TPrev, List<TNext>>>

The link navigation to load below the previous one.

via Expression<Func<TPrev, TIndex>>

Index initializer over the previous row's fields.

Returns

IIncludableQueryable<T, List<TNext>>

Type Parameters

T
TPrev
TNext
TIndex

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

source IIncludableQueryable<T, IEnumerable<TPrev>>

The source query with a pending include.

navigation Expression<Func<TPrev, List<TNext>>>

The link navigation to load below the previous one.

via Expression<Func<TPrev, TIndex>>

Index initializer over the previous row's fields.

handle LinkHandle<TNext>

Handle of this include's link variant.

Returns

IIncludableQueryable<T, List<TNext>>

Type Parameters

T
TPrev
TNext
TIndex

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

source IIncludableQueryable<T, List<TChild>>

The source query with a pending include.

fields Expression<Func<TChild, object>>

Field selector, e.g. pa => new { pa.AnsNr, pa.Na1 }.

Returns

IIncludableQueryable<T, List<TChild>>

Type Parameters

T
TChild