Data Reading Extensions

Extension class for executing aggregable queries. 


namespace KLO128.D3ORM.Common.Extensions
{
    public static class DtoExtensions
}

Assembly

KLO128.D3ORM.Common

Base Types

None

Properties

None

Methods

AggCompute<TEntityOrDTO, TResult>(..) 1/2


public static List<TResult> AggCompute<TEntityOrDTO, TResult>(this IDbConnection connection, ID3Context d3Context, Expression<Func<TResult, IEnumerable<TEntityOrDTO>>>? inverseRootCollection, Expression<Func<TEntityOrDTO, TResult>>? inverseRootDirectProperty, string cmdBatch, int? skip = null, int? take = null, CommandType commandType = CommandType.Text, IEnumerable<DbParameter>? spParameters = null, List<string?>? columnAsIdentifiers = null, int? commandTimeout = null) where TEntityOrDTO : class where TResult : class

Description

Executes computing aggregation functions according to the cmdBatch(2 commands are generated from a specification if the skip and take option is used.) Returns a list of TResult containing the property names and the structure specified by the cmdBatch

If you do not have a special TResult type for this cmdBatch use objectThe result type will then be the Expando object type, which is convertible into IDictionary<string, object?>

Properties with computing aggregate function have this format: SHORTCUT_PropertyName, shortcuts are: CNT, AVG, MIN, MAX, SUM. 

It can be also used for stored procedures if you follow the column naming rules

Return Type

List<TResult>

Type Parameters

  1. TEntityOrDTO : class
  2. TResult : class

Parameters

# Name Type Description Default Value
this connectionIDbConnectionconnection invoker
1. d3Context[ID3Context](./Common-Library%20ID3Context.md)D3Context
2. inverseRootCollectionExpression<Func<TResult, IEnumerable<TEntityOrDTO>>>?"one to many" aggregation of the query root into the result root
3. inverseRootDirectPropertyExpression<Func<TEntityOrDTO, TResult>>?"many to one" aggregation of the query root into the result root
4. cmdBatchstringcommand string
5. skipint?the number of top entity (only) rows to skip from the start of the query result null
6. takeint?the number of top entity (only) rows to take from the result starting at the index following the last skipped row null
7. commandTypeCommandTypecommand type (text or stored procedure) CommandType.Text
8. spParametersIEnumerable<DbParameter>?The parameters used for stored procedure ONLY. null
9. columnAsIdentifiersList<string?>?The column identifiers can be analyzed from the specification and this parameter can be null in that case, but it has to be defined for stored procedures if stored procedure has no corresponding AS identifiers. null
10 commandTimeoutint?command timeout (If null, then the default timeout is used.) null

 

AggCompute<TResult>(..) 2/2


public static List<TResult> AggCompute<TResult>(this IDbConnection connection, ID3Context d3Context, D3SQLAdapter sqlAdapter, int? skip = null, int? take = null, int? commandTimeout = null) where TResult : class

Description

Executes computing aggregation functions according to the sqlAdapterReturns a list of TResult containing the property names and the structure specified by the sqlAdapter

If you do not have a special TResult type for this sqlAdapter use objectThe result type will then be the Expando object type, which is convertible into IDictionary<string, object?>

Properties with computing aggregate function have this format: SHORTCUT_PropertyName, shortcuts are: CNT, AVG, MIN, MAX, SUM. 

Return Type

List<TResult>

Type Parameters

TResult : class

Parameters

# Name Type Description Default Value
this connectionIDbConnectionconnection invoker
1. d3Context[ID3Context](./Common-Library%20ID3Context.md)D3Context
2. sqlAdapterD3SQLAdapterbuilt SQL query adapter
3. skipint?the number of top entity (only) rows to skip from the start of the query result null
4. takeint?the number of top entity (only) rows to take from the result starting at the index following the last skipped row null
5. commandTimeoutint?command timeout (If null, then the default timeout is used.) null

 

AggSelect<TEntityOrDTO, TResult>(..) 1/2


public static List<TResult> AggSelect<TEntityOrDTO, TResult>(this IDbConnection connection, ID3Context d3Context, Expression<Func<TResult, IEnumerable<TEntityOrDTO>>>? inverseRootCollection, Expression<Func<TEntityOrDTO, TResult>>? inverseRootDirectProperty, string cmdBatch, int? skip = null, int? take = null, CommandType commandType = CommandType.Text, IEnumerable<DbParameter>? spParameters = null, List<string?>? columnAsIdentifiers = null, int? commandTimeout = null) where TEntityOrDTO : class, new() where TResult : class, new()

Description

Queries the database by the cmdBatch(2 commands are generated from a specification if the skip and take option is used.) Returns a full object tree (aggregated) list of TResult as a result. 

Can be also used for stored procedures if you follow the column naming rules

Return Type

List<TResult>

Type Parameters

  1. TEntityOrDTO : class
  2. TResult : class, new()

Parameters

# Name Type Description Default Value
this connectionIDbConnectionconnection invoker
1. d3Context[ID3Context](./Common-Library%20ID3Context.md)D3Context
2. inverseRootCollectionExpression<Func<TResult, IEnumerable<TEntityOrDTO>>>?"one to many" aggregation of the query root into the result root
3. inverseRootDirectPropertyExpression<Func<TEntityOrDTO, TResult>>?"many to one" aggregation of the query root into the result root
4. cmdBatchstringcommand string
5. skipint?the number of top entity (only) rows to skip from the start of the query result null
6. takeint?the number of top entity (only) rows to take from the result starting at the index following the last skipped row null
7. commandTypeCommandTypecommand type (text or stored procedure) CommandType.Text
8. spParametersIEnumerable<DbParameter>?The parameters used for stored procedure ONLY. null
9. columnAsIdentifiersList<string?>?The column identifiers can be analyzed from the specification and this parameter can be null in that case, but it has to be defined for stored procedures if stored procedure has no corresponding AS identifiers. null
10. commandTimeoutint?command timeout (If null, then the default timeout is used.) null

 

AggSelect<TResult>(..) 2/2


public static List<TResult> AggSelect<TResult>(this IDbConnection connection, ID3Context d3Context, D3SQLAdapter sqlAdapter, int? skip = null, int? take = null, int? commandTimeout = null) where TResult : class, new()

Description

Queries the database by the sqlAdapterReturns a full object tree (aggregated) list of TResult as a result. 

Return Type

List<TResult>

Type Parameters

TResult : class, new()

Parameters

# Name Type Description Default Value
this connectionIDbConnectionconnection invoker
1. d3Context[ID3Context](./Common-Library%20ID3Context.md)D3Context
2. sqlAdapterD3SQLAdapterbuilt SQL query adapter
3. skipint?the number of top entity (only) rows to skip from the start of the query result null
4. takeint?the number of top entity (only) rows to take from the result starting at the index following the last skipped row null
5. commandTimeoutint?command timeout (If null, then the default timeout is used.) null