Class EntityExtensions
Convenience extension methods over the query builders.
public static class EntityExtensions
- Inheritance
-
EntityExtensions
- Inherited Members
Methods
PrepareFromSql<TResult>(EntityBuilder<TResult>, string)
Prepares the entity's query with the raw sql and returns a reusable prepared
command, so the statement is compiled once and can be executed repeatedly.
public static IPreparedQueryCommand<TResult> PrepareFromSql<TResult>(this EntityBuilder<TResult> entity, string sql)
Parameters
entityEntityBuilder<TResult>The builder whose query receives the raw SQL.
sqlstringThe SQL statement to prepare.
Returns
- IPreparedQueryCommand<TResult>
A command that can be executed repeatedly.
Type Parameters
TResultThe entity type the query selects.
WithSql<TResult>(EntityBuilder<TResult>, string)
Returns the entity's command with its generated SQL replaced by the raw sql
(no parameters are bound; use the overload that takes params for those).
public static QueryCommand<TResult> WithSql<TResult>(this EntityBuilder<TResult> entity, string sql)
Parameters
entityEntityBuilder<TResult>The builder whose query receives the raw SQL.
sqlstringThe SQL statement to run instead of the generated one.
Returns
- QueryCommand<TResult>
A command that runs the raw SQL.
Type Parameters
TResultThe entity type the query selects.
WithSql<TResult>(EntityBuilder<TResult>, string, object?)
Returns the entity's command with its generated SQL replaced by the raw sql
and the public properties of params bound as named parameters.
public static QueryCommand<TResult> WithSql<TResult>(this EntityBuilder<TResult> entity, string sql, object? @params)
Parameters
entityEntityBuilder<TResult>The builder whose query receives the raw SQL.
sqlstringThe SQL statement to run instead of the generated one.
paramsobjectAn object whose public properties become the statement parameters;
nullbinds none.
Returns
- QueryCommand<TResult>
A command that runs the raw SQL.
Type Parameters
TResultThe entity type the query selects.