Interface IColumnsProvider
Supplies the columns available on a query source.
public interface IColumnsProvider
- Extension Methods
Remarks
Declared in ISourceProvider.cs, which no longer matches the type name — prefer a matching
file name. See docs/specs/design/API-NAMING-REVIEW.md finding P2-20.
Properties
HasAliases
Whether any column source has been registered.
bool HasAliases { get; }
Property Value
Methods
Add(QueryCommand, bool)
Registers a nested command as a source that contributes its projection columns.
void Add(QueryCommand queryCommand, bool fromProjection)
Parameters
queryCommandQueryCommandThe source command.
fromProjectionboolWhether the source comes from a projection rather than a table.
Add(Type, bool)
Registers an entity type as a source that contributes columns.
void Add(Type entityType, bool fromProjection)
Parameters
entityTypeTypeThe CLR type of the source entity.
fromProjectionboolWhether the source comes from a projection rather than a table.
Add(Type, bool, ParameterExpression?)
Registers an entity type as a source bound to sourceParameter (#148-B R2.2).
The parameter lets FindAlias(ParameterExpression, bool) resolve this source by
occurrence identity, so two same-CLR-type joined sources stay distinct. The default
implementation ignores the parameter and falls back to the type-keyed registration.
void Add(Type entityType, bool fromProjection, ParameterExpression? sourceParameter)
Parameters
entityTypeTypeThe CLR type of the source entity.
fromProjectionboolWhether the source comes from a projection rather than a table.
sourceParameterParameterExpressionThe lambda parameter that denotes the source, or
null.
FindAlias(ParameterExpression, bool)
Resolves the alias index of param among the sources in the current scope.
Returns null when the parameter does not map to a registered source.
int? FindAlias(ParameterExpression param, bool fromProjection)
Parameters
paramParameterExpressionThe lambda parameter to resolve.
fromProjectionboolWhether to match projection sources.
Returns
- int?
FindAlias(ParameterExpression, bool, bool)
Resolves the alias of param. When includeOuterScopes is
true the current source scope is ignored, so an enclosing command's source can be found
(used for outer-reference markers).
int? FindAlias(ParameterExpression param, bool fromProjection, bool includeOuterScopes)
Parameters
paramParameterExpressionfromProjectionboolincludeOuterScopesbool
Returns
- int?
FindAlias(ParameterExpression, bool, bool, bool)
Resolves the alias of param, also considering the sources of nested commands
that already finished rendering when includeNestedSources is true;
resolving a derived query's output columns needs that.
int? FindAlias(ParameterExpression param, bool fromProjection, bool includeOuterScopes, bool includeNestedSources)
Parameters
paramParameterExpressionThe lambda parameter to resolve.
fromProjectionboolWhether to match projection sources.
includeOuterScopesboolWhether the current source scope is ignored (see the three-argument overload).
includeNestedSourcesboolWhether sources of nested commands are considered too.
Returns
- int?
FindAlias(Type, int?, bool)
Resolves the alias index of a source by entity type, optionally selecting the
paramIdx-th same-typed source. Returns null when no matching source
is in scope.
int? FindAlias(Type entityType, int? paramIdx, bool fromProjection)
Parameters
entityTypeTypeThe source entity type.
paramIdxint?The zero-based index among same-typed sources, or
nullfor the first.fromProjectionboolWhether to match projection sources.
Returns
- int?
FindAlias(Type, int?, bool, bool)
Like FindAlias(Type, int?, bool) but, when no source visible to the current command
matches and includeNestedSources is true, falls back to a source of a
nested command.
int? FindAlias(Type entityType, int? paramIdx, bool fromProjection, bool includeNestedSources)
Parameters
entityTypeTypeThe source entity type.
paramIdxint?The zero-based index among same-typed sources, or
nullfor the first.fromProjectionboolWhether to match projection sources.
includeNestedSourcesboolWhether sources of nested commands are considered too.
Returns
- int?
FindInScopeQueryCommand(ParameterExpression, bool)
Returns the alias index and nested command of the in-scope source that
param resolves to, or null when the parameter does not map to a source
of the current scope. Unlike FindInScopeQueryCommand(Type) this uses the
parameter's identity, so two same-typed sources in one command are told apart.
(int Index, QueryCommand? Command)? FindInScopeQueryCommand(ParameterExpression param, bool fromProjection)
Parameters
paramParameterExpressionThe lambda parameter whose source is resolved.
fromProjectionboolWhether to match projection sources.
Returns
- (int Index, QueryCommand Command)?
FindInScopeQueryCommand(Type)
Returns the alias index and nested command of the source of entityType that
belongs to the command currently being rendered, or null when that type is not a source
of the current scope. Unlike FindQueryCommand(Type, bool) this never falls back to
an out-of-scope source, so a derived-table reference is only resolved where the derived source is
actually in scope.
(int Index, QueryCommand? Command)? FindInScopeQueryCommand(Type entityType)
Parameters
entityTypeTypeThe source entity type.
Returns
- (int Index, QueryCommand Command)?
FindQueryCommand(Type)
Returns the alias index and nested command of the source of entityType,
preferring an in-scope source and falling back to the most recently added out-of-scope one.
(int, QueryCommand?) FindQueryCommand(Type entityType)
Parameters
entityTypeTypeThe source entity type.
Returns
- (int, QueryCommand)
FindQueryCommand(Type, bool)
Like FindQueryCommand(Type) but, when no source visible to the current command
matches and includeNestedSources is true, falls back to a source of a
nested command.
(int, QueryCommand?) FindQueryCommand(Type entityType, bool includeNestedSources)
Parameters
entityTypeTypeThe source entity type.
includeNestedSourcesboolWhether sources of nested commands are considered too.
Returns
- (int, QueryCommand)
PopScope()
Pops the most recently pushed parameter scope.
void PopScope()
PopSourceScope()
Ends the scope opened by PushSourceScope(). Its entries remain addressable by index (aliases are assigned globally), but stop satisfying any enclosing command's lookups.
void PopSourceScope()
PushScope(ReadOnlyCollection<ParameterExpression>)
Pushes a parameter scope that disambiguates same-typed sources from the enclosing scope.
void PushScope(ReadOnlyCollection<ParameterExpression> parameters)
Parameters
parametersReadOnlyCollection<ParameterExpression>The lambda parameters that belong to the scope.
PushSourceScope()
Marks the source entries added from now on as belonging to the command currently being rendered, so that FindAlias(ParameterExpression, bool) of a nested command does not resolve to a same-typed source of an unrelated sibling command (or of the outer query).
void PushSourceScope()