Table of Contents

Class JoinedQuery<TLeft, TRight, TResult>

Namespace
CL.MySQL2.Services
Assembly
CL.MySQL2.dll

A typed two-table join. Built by Join<TRight, TKey, TResult>(Expression<Func<T, TKey>>, Expression<Func<TRight, TKey>>, Expression<Func<T, TRight, TResult>>, JoinType); the left side is aliased t0 and the right side t1. The result selector projects matched rows into TResult — only the referenced columns are transferred, materialized by a compiled (reflection-free) row mapper.

Supports Where(Expression<Func<TLeft, TRight, bool>>), OrderBy<TKey>(Expression<Func<TLeft, TRight, TKey>>) / OrderByDescending<TKey>(Expression<Func<TLeft, TRight, TKey>>), Take(int) / Skip(int), and the ToListAsync / FirstOrDefaultAsync / CountAsync terminals.

Not cacheable in this version. The result cache stamps entries with a single table's version counter, so a join entry could not be invalidated when the other joined table mutates. Rather than ship a cache that silently serves stale joins, .WithCache / .SmartCache are intentionally absent here. Multi-table invalidation is on the roadmap.

public sealed class JoinedQuery<TLeft, TRight, TResult> where TLeft : class, new() where TRight : class, new()

Type Parameters

TLeft
TRight
TResult
Inheritance
JoinedQuery<TLeft, TRight, TResult>
Inherited Members

Methods

CountAsync(CancellationToken)

public Task<Result<long>> CountAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<Result<long>>

FirstOrDefaultAsync(CancellationToken)

public Task<Result<TResult?>> FirstOrDefaultAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<Result<TResult>>

Limit(int)

public JoinedQuery<TLeft, TRight, TResult> Limit(int count)

Parameters

count int

Returns

JoinedQuery<TLeft, TRight, TResult>

Offset(int)

public JoinedQuery<TLeft, TRight, TResult> Offset(int count)

Parameters

count int

Returns

JoinedQuery<TLeft, TRight, TResult>

OrderByDescending<TKey>(Expression<Func<TLeft, TRight, TKey>>)

Orders descending by a column from either side.

public JoinedQuery<TLeft, TRight, TResult> OrderByDescending<TKey>(Expression<Func<TLeft, TRight, TKey>> selector)

Parameters

selector Expression<Func<TLeft, TRight, TKey>>

Returns

JoinedQuery<TLeft, TRight, TResult>

Type Parameters

TKey

OrderBy<TKey>(Expression<Func<TLeft, TRight, TKey>>)

Orders ascending by a column from either side: (o, c) => o.CreatedUtc.

public JoinedQuery<TLeft, TRight, TResult> OrderBy<TKey>(Expression<Func<TLeft, TRight, TKey>> selector)

Parameters

selector Expression<Func<TLeft, TRight, TKey>>

Returns

JoinedQuery<TLeft, TRight, TResult>

Type Parameters

TKey

Skip(int)

public JoinedQuery<TLeft, TRight, TResult> Skip(int count)

Parameters

count int

Returns

JoinedQuery<TLeft, TRight, TResult>

Take(int)

public JoinedQuery<TLeft, TRight, TResult> Take(int count)

Parameters

count int

Returns

JoinedQuery<TLeft, TRight, TResult>

ToListAsync(CancellationToken)

public Task<Result<List<TResult>>> ToListAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<Result<List<TResult>>>

Where(Expression<Func<TLeft, TRight, bool>>)

Filters matched rows. The predicate may reference either side, e.g. (o, c) => o.Total > 100 && c.Country == "DK".

public JoinedQuery<TLeft, TRight, TResult> Where(Expression<Func<TLeft, TRight, bool>> predicate)

Parameters

predicate Expression<Func<TLeft, TRight, bool>>

Returns

JoinedQuery<TLeft, TRight, TResult>