DbGate class

Represents base class which allows to get DB structure information availble for some connection

public abstract class Korzh.EasyQuery.Db.DbGate
    : IDisposable

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

Assembly: Korzh.EasyQuery.Db.dll

Constructors

Name Type Description
DbGate() void Initializes a new instance of the Korzh.EasyQuery.Db.DbGate class.

Properties

Name Type Description
Connected bool Gets or sets a value indicating whether this DbGate is connected. When this property is assigned to true then the object tries to connect to database.
Connection DbConnection Gets the connection.
ConnectionIsInternalSetted bool
ConnectionString string Gets or sets the connection string.
ConnectionStringBuilderDlg IConnectionStringBuilderDlg Gets or sets the connection string builder dialog.
FinalConnectionString string
LoginPrompt bool Gets or sets a value indicating whether Korzh.EasyQuery.Db.DbGate object should ask user for login and password when connect to database.
Password string Gets or sets the "Password" parameter of database connection.
ProgressIndicator IProgressIndicator Gets or sets the progress indicator object.
UserID string Gets or sets the "User ID" parameter of database connection.
UseViews bool Gets or sets a value indicating whether Korzh.EasyQuery.Db.DbGate will add views in the list of tables returned by Korzh.EasyQuery.Db.DbGate.GetTables(System.String,System.String) method.
Version string Gets the version of the current Korzh.EasyQuery.Db.DbGate implementation

Events

Name Type Description
LoginRequest LoginRequestEventHandler Occurs when the Korzh.EasyQuery.Db.DbGate objects needs to get Korzh.EasyQuery.Db.DbGate.UserID and Korzh.EasyQuery.Db.DbGate.Password to connect to some database.

Methods

Name Type Description
AssembleConnectionString() string Builds the final connection string based on the string defined in Korzh.EasyQuery.Db.DbGate.ConnectionString property, current environment variables and the parameters defined in UserID and Password properties.
CheckConnection() void Checks the connection. Calls CoreCheckConnection() method.
CoreCheckConnection() void When overriden in derived class, performs the actual connection checking
CoreGetDatabases(DbInfoList databases) void Core implementation of Korzh.EasyQuery.Db.DbGate.GetDatabases method.
CoreGetFields(string dbName, string schemaName, string tableName, DbFieldInfoList fields) void Core implementation of Korzh.EasyQuery.Db.DbGate.GetFields(System.String,System.String,System.String) method.
CoreGetFieldsBySQL(string sql, DbFieldInfoList fields) void Core implementation of Korzh.EasyQuery.Db.DbGate.GetFieldsBySQL(System.String) method.
CoreGetLinks(string dbName, string schemaName, DbLinkInfoList links) void Core implementation of Korzh.EasyQuery.Db.DbGate.GetLinks(System.String,System.String) method.
CoreGetTables(string dbName, string schemaName, DbTableInfoList tables) void Core implementation of Korzh.EasyQuery.Db.DbGate.GetTables(System.String,System.String) method.
CoreLoadParams(DbParameters dbParams) void Core implementation of Korzh.EasyQuery.Db.DbGate.LoadParams(Korzh.EasyQuery.Db.DbParameters) method.
CoreSaveParams(DbParameters dbParams) void Core implementation of Korzh.EasyQuery.Db.DbGate.SaveParams(Korzh.EasyQuery.Db.DbParameters) method.
Dispose(bool disposing) void Releases unmanaged and - optionally - managed resources.
Dispose() void Releases unmanaged and - optionally - managed resources.
GetConnected() bool Core implemenation of "get" method of Korzh.EasyQuery.Db.DbGate.Connected property.
GetConnection() DbConnection When overriden in derived class, returns the connection
GetDataAdapter(string sqlText) DbDataAdapter Gets the data adapter.
GetDatabases() DbInfoList Gets the list of available databases.
GetFields(string dbName, string schemaName, string tableName) DbFieldInfoList Gets the fields by table.
GetFieldsBySQL(string sql) DbFieldInfoList Gets the fields of result set of some SQL statement execution.
GetFieldsEx(string dbName, string schemaName, string tableName, bool sortByOriginalPosition) DbFieldInfoList Gets the fields by table.
GetFormatType() FormatType Returns the format type for this DB gate
GetGateId() string Gets the id of Korzh.EasyQuery.Db.DbGate. Must be overrided in inherited classes
GetLinks(string dbName, string schemaName) DbLinkInfoList Gets the list of available tables.
GetName() string Gets the name of Korzh.EasyQuery.Db.DbGate. Must be overrided in inherited classes
GetPwdName() string Gets the name of "password" attribute in connection string.
GetSqlDialect() string Gets the name of default SQL dialect. Can be overrided in inherited classes
GetTableFieldsMap(string dbName, string schemaName) Dictionary<string, DbFieldInfoList> Returns all table fields map for the particular DB and schema. Called in Korzh.EasyQuery.Db.DbGate.CoreGetFields(System.String,System.String,System.String,Korzh.EasyQuery.Db.DbFieldInfoList)
GetTables(string dbName, string schemaName) DbTableInfoList Gets the list of available tables.
GetUidName() string Gets the name of User ID attribute in connection string
GetVersion() string Core implemenation of Korzh.EasyQuery.Db.DbGate.Version property. Must be overrided in descendants.
LoadParams(DbParameters dbParams) void Loads the connection parameters.
LogDebug(string message, Object[] args) void Formats and writes a debug log message.
LogError(string message, Object[] args) void Formats and writes an error log message.
LogInfo(string message, Object[] args) void Formats and writes an informational log message.
OnLoginRequest() void Raises the LoginRequest event and filled UserID and Password by values returned in event arguments
SaveParams(DbParameters dbParams) void Saves the connection parameters.
SetConnected(bool connected) void Core implemenation of "set" method of Korzh.EasyQuery.Db.DbGate.Connected property.
SetConnection(DbConnection value) void
SetLogger(ILogger logger) void Set a logger
SetProgress(int pos) void Set the progress to the specified position.
SetProgressMinMax(int min, int max) void Sets the minimum and maximum of progress indicator.
ToString() string Returns a System.String that represents the current System.Object.

Static Fields

Name Type Description
ConnectionType Type Gets the type of the connection.
DbGateTypes Collection<Type> The list of all registered DbGate types (descendants of DbGate)

Static Methods

Name Type Description
DbTypeByDataType(DataType dt) SqlDbType Gets SqlDbType object which coressponds to DataType object specified in parameter
Register(Type gateType) void Registers the specified gate type.