Table of Contents

Class JoinOptions

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Per-join options applied while the join is declared, through the trailing Action<JoinOptions> parameter of the Join/LeftJoin/RightJoin/ FullJoin/SemiJoin/AntiJoin/PasteJoin/CrossJoin/CrossApply/ OuterApply and JoinInto overloads (for example a.Join(b, (x, y) => x.Id == y.Id, j => j.WithStrictness(JoinStrictness.Any))). The values are copied into the resulting join, so the options object is not retained. The raw named-table (TableAlias) CrossJoin/CrossApply/OuterApply overloads take no options: those joins cannot carry the modifiers described here.

public sealed class JoinOptions
Inheritance
JoinOptions
Inherited Members
Extension Methods

Methods

ForShare()

Locks the selected rows of this join's physical source in shared mode until the transaction ends, blocking while a locked row is held by another transaction. On PostgreSQL/MySQL it renders a targeted FOR SHARE OF <alias> clause; on SQL Server it applies the holdlock table hint to this join's table only. Requires a dialect whose lock renderer reports SupportsSourceLocks.

public JoinOptions ForShare()

Returns

JoinOptions

This instance, to allow chaining.

ForShare(LockWaitMode)

Locks the selected rows of this join's physical source in shared mode until the transaction ends, with the requested wait behaviour for rows already locked by another transaction. Requires a dialect whose lock renderer reports SupportsSourceLocks.

public JoinOptions ForShare(LockWaitMode wait)

Parameters

wait LockWaitMode

How to react to a row already locked by another transaction.

Returns

JoinOptions

This instance, to allow chaining.

ForUpdate()

Locks the selected rows of this join's physical source exclusively until the transaction ends, blocking while a locked row is held by another transaction. On PostgreSQL/MySQL it renders a targeted FOR UPDATE OF <alias> clause; on SQL Server it applies the updlock table hint to this join's table only. Requires a dialect whose lock renderer reports SupportsSourceLocks; a dialect without it (for example MariaDB) rejects the command with NotSupportedException.

public JoinOptions ForUpdate()

Returns

JoinOptions

This instance, to allow chaining.

ForUpdate(LockWaitMode)

Locks the selected rows of this join's physical source exclusively until the transaction ends, with the requested wait behaviour for rows already locked by another transaction. Requires a dialect whose lock renderer reports SupportsSourceLocks.

public JoinOptions ForUpdate(LockWaitMode wait)

Parameters

wait LockWaitMode

How to react to a row already locked by another transaction.

Returns

JoinOptions

This instance, to allow chaining.

ManyToMany<TParent, TChild, TJunction, TParentKey, TChildKey>(Expression<Func<TParent, TParentKey>>, Expression<Func<TJunction, TParentKey>>, Expression<Func<TChild, TChildKey>>, Expression<Func<TJunction, TChildKey>>)

Configures a many-to-many relationship for a collection JoinInto call locally, without declaring it in metadata: the keys on both principal sides and the two junction foreign keys that reference them. The configuration fully replaces the declared relationship for this call.

public JoinOptions ManyToMany<TParent, TChild, TJunction, TParentKey, TChildKey>(Expression<Func<TParent, TParentKey>> parentKey, Expression<Func<TJunction, TParentKey>> junctionParentForeignKey, Expression<Func<TChild, TChildKey>> childKey, Expression<Func<TJunction, TChildKey>> junctionChildForeignKey) where TChild : class where TJunction : class

Parameters

parentKey Expression<Func<TParent, TParentKey>>

Selects the parent-side key property, for example p => p.Id.

junctionParentForeignKey Expression<Func<TJunction, TParentKey>>

Selects the junction foreign key referencing the parent key, for example l => l.ParentId.

childKey Expression<Func<TChild, TChildKey>>

Selects the child-side key property, for example c => c.Id.

junctionChildForeignKey Expression<Func<TJunction, TChildKey>>

Selects the junction foreign key referencing the child key, for example l => l.ChildId.

Returns

JoinOptions

This instance, to allow chaining.

Type Parameters

TParent

The parent entity type of the calling JoinInto.

TChild

The child entity type of the calling JoinInto.

TJunction

The junction (link) entity type.

TParentKey

The property type shared by the parent key and the junction parent foreign key.

TChildKey

The property type shared by the child key and the junction child foreign key.

Exceptions

ArgumentNullException

A selector is null.

InvalidOperationException

A relationship was already configured on this instance.

NotSupportedException

A key does not match its junction foreign key's type.

OneToOne<TParent, TChild, TKey>(Expression<Func<TParent, TKey>>, Expression<Func<TChild, TKey>>)

Configures the relationship for a one-to-one JoinInto call locally, without declaring it in metadata: the parent-side key on TParent and the (trusted, not validated) unique foreign key on TChild. The foreign-key uniqueness is not checked by the core against the schema or the data; the only runtime guard rejects two distinct non-null child identities for one parent. The configuration fully replaces the declared relationship for this call.

public JoinOptions OneToOne<TParent, TChild, TKey>(Expression<Func<TParent, TKey>> parentKey, Expression<Func<TChild, TKey>> childForeignKey) where TChild : class

Parameters

parentKey Expression<Func<TParent, TKey>>

Selects the parent-side key property, for example p => p.Id.

childForeignKey Expression<Func<TChild, TKey>>

Selects the foreign-key property on the child, for example c => c.ParentId.

Returns

JoinOptions

This instance, to allow chaining.

Type Parameters

TParent

The parent entity type of the calling JoinInto.

TChild

The child entity type of the calling JoinInto.

TKey

The property type shared by the parent key and the child foreign key.

Exceptions

ArgumentNullException

A selector is null.

InvalidOperationException

A relationship was already configured on this instance.

SuppressCartesianWarning()

Suppresses the JoinInto.MultipleCollections warning that is emitted when a query declares two or more collection navigations (including many-to-many declarations), whose joins multiply the parent rows. Suppression applies only to this join, but the warning is silenced for the whole query as soon as any declared join sets it. The flag is never part of the plan key and never throws; it only affects the diagnostic.

public JoinOptions SuppressCartesianWarning()

Returns

JoinOptions

This instance, to allow chaining.

WithJoinHint(string)

Attaches a provider-specific hint to this join, for example SQL Server j => j.WithJoinHint("loop") which renders inner loop join. On PostgreSQL/MySQL/MariaDB the hint is folded into the statement-level /*+ ... */ comment (append the aliases yourself, e.g. NestLoop(t1 t2)); a dialect that supports neither form rejects the command with NotSupportedException.

public JoinOptions WithJoinHint(string hint)

Parameters

hint string

The join hint text; must be non-empty.

Returns

JoinOptions

This instance, to allow chaining.

Exceptions

ArgumentException

hint is null, empty or whitespace.

WithJoinTableHint(params string[])

Attaches table-level hints to this join, for example SQL Server j => j.WithJoinTableHint("nolock") which renders a WITH (nolock) clause on that joined table only. This is the per-join counterpart of WithTableHint(params string[]) and is distinct from the optimizer join hint WithJoinHint(string); unlike WithTablesInScopeHint(params string[]) it never leaks to the other physical tables. Hints are rendered verbatim, so only pass trusted values; null/blank entries are ignored, and a call that supplies only ignored entries leaves the hints unchanged. Requires a dialect that supports table hints (see SupportsTableHints) and a physical-table join source (an APPLY, derived-table, table-valued-function or XML/pivot join source is rejected).

public JoinOptions WithJoinTableHint(params string[] hints)

Parameters

hints string[]

The table hints to apply to the joined table (for example nolock).

Returns

JoinOptions

This instance, to allow chaining.