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

Constructors

Name Type Description
EasyQueryManagerSql() void Initializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManagerSql class.
EasyQueryManagerSql(EasyQueryOptions options) void Initializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManagerSql class.
EasyQueryManagerSql(EasyQueryOptions options, IServiceProvider services) void Initializes a new instance of the Korzh.EasyQuery.Services.EasyQueryManagerSql class.

Properties

Name Type Description
ConnectionResolver Func<DbConnection> Gets or sets the connection resolver - a faunction that returs a connection object by model's ID.
DbCommandTuner Action<DbCommand> Gets or sets the function which is called before execution of some DbCommand.
Formats SqlFormats The SQL formats.
Model DbModel Gets the current model. The value of this property is set on the first call of GetModel method.
Query DbQuery Gets the current query. The value of this property is set on the first call of GetQueryAsync method.
QueryBuilder SqlQueryBuilder Returns QueryBuilder associated with current Query

Methods

Name Type Description
BuildQuery(QueryBuilderOptions options = null) IQueryStatement Builds a Korzh.EasyQuery.IQueryStatement object by the Korzh.EasyQuery.Services.EasyQueryManagerSql.Query and returns the built statement.
CreateDbResultSet(IDataReader dataReader, ResultSetOptions settings) EasyDbResultSet Creates result set
CreateModelCore(string modelId = null) DataModel Creates new DataModel object
CreateQueryBuilderCore() IQueryBuilder 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.
CreateQueryCore() Query Creates new DbQuery object.
Dispose(bool disposing) void Releases 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() DbConnection 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.
GetConnectionCore() DbConnection 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.
GetDataExportSettings(string format) IDataExportSettings Gets the data export settings.
GetEmptyResultSet() IEqResultSet Gets 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) DbCommand Creates and prepares the database command.
ReadClientOptions(JObject clientOptions) void

Static Methods

Name Type Description
RegisterDbGate() void