EasyQueryManagerSql class

Represents an implementation of Korzh.EasyQuery.Services.EasyQueryManager which generates SQL queries and can work with some relational DB directly.

public class Korzh.EasyQuery.Services.EasyQueryManagerSql
    : EasyQueryManager


Type Name Description
Func<String, DbConnection> ConnectionResolver Gets or sets the connection resolver - a faunction that returs a connection object by model's ID.
Action<DbCommand> DbCommandTuner Gets or sets the function which is called before execution of some DbCommand.


Type Name Description
QueryBuilderResult BuildQuery(JObject options = null, Boolean addPaging = False) Builds SQL statement by the DbQuery object. This methods calls QueryBuilder delegate to build SQL.
DataModel CreateModelCore(String modelId) Creates new DataModel object
Query CreateQueryCore(DataModel model) Creates new DbQuery object.
IEqResultSet ExecuteQueryCore(JObject options = null) The actual implemenation of ExecuteQuery function. This method is overridden in EasyQueryManagerBase descendants like EasyQueryManagerSql or EasyQueryManagerLinq.
DbConnection GetConnection(String modelId) Gets the DbConnection associated with this service. If connection is not defined yet - it wil be resolved using ConnectionResolver. This method opens the connection if it's not opened yet.
DbConnection GetConnectionCore(String modelId) Returns the connection object. The default implementations just calls ConnectionResolved to get the connection. You can override this function in dervived class to implement your own behavior of resolving the connnection by the model ID.
IDataReader GetDataReader(JObject options = null, Boolean addPaging = False) Gets the data reader by query. This function is called from ExecuteQuery or ExportQueryResult.
IEqResultSet GetEmptyResultSet() Gets any empty result set.
IQueryBuilder GetQueryBuilderCore(Query query, JObject options) Returns the query builder. In this particular kind of EasyQueryManager it will be an instance of SqlQueryBuilder. This method also builds the query so you can read the result via GetResult method call.
Int64 GetRecordCount() Gets the record count for the current query
DbCommand PrepareDbCommand(String sql, QueryParamList queryParams = null) Creates and prepares the database command.
IEqResultSet RetrieveResultSet(String modelId, QueryBuilderResult qbr) Creates and returns a ResultSet object by SQL statement.

Static Methods

Type Name Description
void RegisterDbGate()