Interface ILockRenderer
A dialect's renderer for row locking. UsesTableHints selects the shape of the token
Render(LockMode, KeywordCase) returns: a trailing FOR UPDATE/FOR SHARE clause, or a bare table
hint (the caller wraps it in WITH (...)). The object's presence is the capability, and since
one shape is selected by UsesTableHints the renderer never has an unreachable method.
A dialect that can express NOWAIT/SKIP LOCKED additionally overrides
Render(LockMode, LockWaitMode, KeywordCase); the inherited default only supports
Wait and throws NotSupportedException for the other modes.
public interface ILockRenderer
- Extension Methods
Properties
SupportsSourceLocks
Whether the dialect can lock a single named source (FOR UPDATE OF <alias>/
FOR SHARE OF <alias>, or a per-source table hint on a table-hint dialect). The safe
default is false: a dialect that has not implemented source-level locking must
reject it fail-closed instead of silently emitting a whole-query lock. MariaDB overrides it back to
false because its grammar has no OF form.
bool SupportsSourceLocks { get; }
Property Value
UsesTableHints
True when the dialect expresses locking as a table hint rather than a trailing clause.
bool UsesTableHints { get; }
Property Value
Methods
Render(LockMode, KeywordCase)
Renders the locking token for mode: the trailing clause when
UsesTableHints is false, otherwise the bare table-hint token.
string Render(LockMode mode, KeywordCase keywordCase = KeywordCase.Lower)
Parameters
modeLockModekeywordCaseKeywordCase
Returns
Render(LockMode, LockWaitMode, KeywordCase)
Renders the locking token for mode with the requested wait
behaviour for rows already locked by another transaction. The default implementation supports only
Wait (delegating to Render(LockMode, KeywordCase)) and rejects
a non-blocking mode with NotSupportedException; a dialect whose provider can express
NOWAIT/SKIP LOCKED overrides it.
string Render(LockMode mode, LockWaitMode wait, KeywordCase keywordCase = KeywordCase.Lower)
Parameters
modeLockModeThe row-locking strength.
waitLockWaitModeHow to react to a row already locked by another transaction.
keywordCaseKeywordCaseSelects the letter case of the emitted SQL keywords.
Returns
Render(LockMode, LockWaitMode, KeywordCase, string?)
Renders the locking token for mode/wait restricted to the
source declared as targetAlias. A null target is the
whole-query rendering and delegates to Render(LockMode, LockWaitMode, KeywordCase).
The default implementation is fail-closed: it rejects any non-null target with
NotSupportedException rather than silently widening it to a whole-query lock. A
dialect whose grammar can express a targeted lock overrides it.
string Render(LockMode mode, LockWaitMode wait, KeywordCase keywordCase, string? targetAlias)
Parameters
modeLockModeThe row-locking strength.
waitLockWaitModeHow to react to a row already locked by another transaction.
keywordCaseKeywordCaseSelects the letter case of the emitted SQL keywords.
targetAliasstringThe already-resolved, quoted alias of the locked source, or
nullfor a whole-query lock.