Skip to content

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

Package: Korzh.EasyQuery.Db (targets: netstandard2.0)

Assembly: Korzh.EasyQuery.Db.dll

NameTypeDescription
EasyQueryManagerSql()voidInitializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManagerSql class.
EasyQueryManagerSql(EasyQueryOptions options)voidInitializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManagerSql class.
EasyQueryManagerSql(EasyQueryOptions options, IServiceProvider services)voidInitializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManagerSql class.
NameTypeDescription
ConnectionResolverFunc<DbConnection>Gets or sets the connection resolver - a faunction that returs a connection object by model’s ID.
DbCommandTunerAction<DbCommand>Gets or sets the function which is called before execution of some DbCommand.
FormatsSqlFormatsThe SQL formats.
ModelDbModelGets the current model. The value of this property is set on the first call of GetModel method.
QueryDbQueryGets the current query. The value of this property is set on the first call of GetQueryAsync method.
QueryBuilderSqlQueryBuilderReturns QueryBuilder associated with current Query
NameTypeDescription
BuildQuery(QueryBuilderOptions options = null)IQueryStatementBuilds a Korzh.EasyQuery.IQueryStatement object by the Korzh.EasyQuery.Services.EasyQueryManagerSql.Query and returns the built statement.
CreateDbResultSet(IDataReader dataReader, ResultSetOptions settings)EasyDbResultSetCreates result set
CreateModelCore(string modelId = null)DataModelCreates new DataModel object
CreateQueryBuilderCore()IQueryBuilderReturns 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.
CreateQueryCore()QueryCreates new DbQuery object.
Dispose(bool disposing)voidReleases unmanaged and - optionally - managed resources.
FetchDataCoreAsync()Task<IEqResultSet>The actual implemenation of FetchData function. This method is overridden in EasyQueryManagerBase descendants like EasyQueryManagerSql or EasyQueryManagerLinq.
GetConnection()DbConnectionGets 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.
GetConnectionCore()DbConnectionReturns 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.
GetDataExportSettings(string format)IDataExportSettingsGets the data export settings.
GetEmptyResultSet()IEqResultSetGets any empty result set.
GetRecordCountAsync()Task<long>Gets the record count for the current query
GetResultSetAsync(IQueryStatement statement, ResultSetOptions settings = null)Task<IEqResultSet>Creates and returns a ResultSet object by SQL statement.
PrepareDbCommand(SqlStatement statement)DbCommandCreates and prepares the database command.
ReadClientOptions(JObject clientOptions)void
NameTypeDescription
RegisterDbGate()void