Class CustomQuery<TResultType>
Provides the means to execute query objects.
Inheritance
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 SourceCustomQuery(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. |
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 SourceCommand
Gets or sets the command.
Declaration
protected IDatabaseCommand Command { get; set; }
Property Value
Type | Description |
---|---|
IDatabaseCommand |
CommandText
Gets the command text.
Declaration
protected string CommandText { get; }
Property Value
Type | Description |
---|---|
System.String |
Connector
Gets the database connector.
Declaration
protected IDatabaseConnector Connector { get; }
Property Value
Type | Description |
---|---|
IDatabaseConnector |
Descriptor
Gets the custom type descriptor.
Declaration
protected ICustomTypeDescriptor Descriptor { get; }
Property Value
Type | Description |
---|---|
ICustomTypeDescriptor |
Mapper
Gets the database reader mapper.
Declaration
protected IDatabaseReaderMapper<TResultType> Mapper { get; }
Property Value
Type | Description |
---|---|
IDatabaseReaderMapper<TResultType> |
Methods
| Improve this Doc View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
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 |
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 |