Show / Hide Table of Contents

Class CustomQuery<TResultType>

Provides the means to execute query objects.

Inheritance
System.Object
CustomQuery<TResultType>
Implements
IQuery<TResultType>
IDisposable
Namespace: Paradigm.ORM.Data.Querying
Assembly: Paradigm.ORM.Data.dll
Syntax
public class CustomQuery<TResultType> : object, IQuery<TResultType>, IDisposable where TResultType : class
Type Parameters
Name Description
TResultType

The type containing or referencing the mapping information, that will be returned after executing the query.

Remarks

A query object encapsulates all the steps in a data reader operation. Basically contains a table type descriptor, a command and a database reader mapper. The basic idea behind a query is to facilitate the creation of queries, and the ability to reuse them if neccessary. The difference between a query and a custom query, is that a custom query does not uses the default select command, but allows the user to provide a custom select to the database. But even with a custom query string, the custom query requires the table type descriptor to known how to map the results.

Constructors

| Improve this Doc View Source

CustomQuery(IDatabaseConnector, String)

Initializes a new instance of the CustomQuery<TResultType> class.

Declaration
public CustomQuery(IDatabaseConnector connector, string query)
Parameters
Type Name Description
IDatabaseConnector connector

The database connector.

System.String query

The query.

| Improve this Doc View Source

CustomQuery(IDatabaseConnector, String, ICustomTypeDescriptor)

Initializes a new instance of the CustomQuery<TResultType> class.

Declaration
public CustomQuery(IDatabaseConnector connector, string query, ICustomTypeDescriptor descriptor)
Parameters
Type Name Description
IDatabaseConnector connector

The database connector.

System.String query

The query.

ICustomTypeDescriptor descriptor

The custom type descriptor.

Properties

| Improve this Doc View Source

Command

Gets or sets the command.

Declaration
protected IDatabaseCommand Command { get; set; }
Property Value
Type Description
IDatabaseCommand
| Improve this Doc View Source

CommandText

Gets the command text.

Declaration
protected string CommandText { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Connector

Gets the database connector.

Declaration
protected IDatabaseConnector Connector { get; }
Property Value
Type Description
IDatabaseConnector
| Improve this Doc View Source

Descriptor

Gets the custom type descriptor.

Declaration
protected ICustomTypeDescriptor Descriptor { get; }
Property Value
Type Description
ICustomTypeDescriptor
| Improve this Doc View Source

Mapper

Gets the database reader mapper.

Declaration
protected IDatabaseReaderMapper<TResultType> Mapper { get; }
Property Value
Type Description
IDatabaseReaderMapper<TResultType>

Methods

| Improve this Doc View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
| Improve this Doc View Source

Execute(String, Object[])

Executes the specified query and returns a list of .

Declaration
public List<TResultType> Execute(string whereClause = null, params object[] parameters)
Parameters
Type Name Description
System.String whereClause

A where filter clause. Do not add the "WHERE" keyword to it. If you need to pass parameters, pass using @1, @2, @3.

System.Object[] parameters

A list of parameter values.

Returns
Type Description
List<TResultType>

A list of .

| Improve this Doc View Source

ExecuteAsync(String, Object[])

Executes the specified query and returns a list of .

Declaration
public Task<List<TResultType>> ExecuteAsync(string whereClause = null, params object[] parameters)
Parameters
Type Name Description
System.String whereClause

A where filter clause. Do not add the "WHERE" keyword to it. If you need to pass parameters, pass using @1, @2, @3.

System.Object[] parameters

A list of parameter values.

Returns
Type Description
Task<List<TResultType>>

A list of .

Implements

IQuery<TResultType>
IDisposable

Extension Methods

ObjectExtensions.ThrowIfFails<TException>(Object, Action, String)
ObjectExtensions.ThrowIfFails<TException, TResult>(Object, Func<TResult>, String)
ObjectExtensions.ThrowIfFailsAsync<TException>(Object, Func<Task>, String)
ObjectExtensions.ThrowIfFailsAsync<TException, TResult>(Object, Func<Task<TResult>>, String)

See Also

IQuery<TResultType>
  • Improve this Doc
  • View Source
Powered by MiracleDevs ©2017. Code licensed under the MIT License.
Documentation generated by DocFX.