Abstract base class for implementator of IDbAccess
Default constructor
protected Void AbstractDbAccess()
Type | Name | Summary |
---|---|---|
InfoMessageEventHandler | InfoMessage | Occurs when the database engine returns a warning of informational message. |
Application name.
public String ApplicationName { get; set; }
Catalog (database name).
public String Catalog { get; set; }
Connection time-out.
public Nullable<Int32> ConnectionTimeout { get; set; }
Default schema for database objects.
public String DefaultSchema { get; set; }
Allows to extend the connection string builded from the object.
public String ExtendedConnectionString { get; set; }
Whether the InfoMessage event handler has been setted.
protected Boolean HasInfoMessageHandler { get; }
Indicates whether the connection is opened.
public Boolean IsConnectionOpen { get; }
Indicates whether an opened connection is in a transaction.
public Boolean IsInTransaction { get; }
Maximum number of elements of the connection pool.
public Nullable<Int32> MaxPoolSize { get; set; }
Name of the object.
public String Name { get; set; }
Sets the password of the user used to connect to the database.
public String Password { set; }
Whether connection pooling is enabled or not.
public Nullable<Boolean> Pooling { get; set; }
Port where the database server is listening.
public Int32 Port { get; set; }
Specify how many times a failed operation will be retried.
public Int32 Retries { get; set; }
Server name or it's IP address.
public String ServerName { get; set; }
Name of the connection string builder to use.
public String UseConnectionStringBuilder { get; set; }
Gets or sets if integrated security must be used.
public Boolean UseIntegratedSecurity { get; set; }
User name to connecto to the database.
public String UserName { set; }
Adds a new parameter to the command passed as parameter
public Void AddParameter(command, name, type, direction, value)
Name | Type | Summary |
---|---|---|
command | IDbCommand | The command where the parameter will be added |
name | String | The quoted parameter name |
type | DbType | The parameter data type |
direction | ParameterDirection | The parameter direction |
value | Object | The value of the parameter |
Adds a new parameter to the command passed as parameter
public Void AddParameter(command, name, type, direction, size, value)
Name | Type | Summary |
---|---|---|
command | IDbCommand | The command where the parameter will be added |
name | String | The quoted parameter name |
type | DbType | The parameter data type |
direction | ParameterDirection | The parameter direction |
size | Int32 | The size of the data in the valueparameter |
value | Object | The value of the parameter |
Initiates a database transaction
public IDbTransaction BeginTransaction()
An object representing the new transaction
Initiates a database transaction with the specified isolation level
public IDbTransaction BeginTransaction(iso)
Ann object representing the new transaction
Name | Type | Summary |
---|---|---|
iso | IsolationLevel | Isolation level for the transaction |
Closes the database connection if it is opened
public Void CloseConnection()
Commits the running database transaction
public Void CommitTransaction()
Creates a new database command
public IDbCommand CreateCommand(commandType)
An object representing the newly created command
Name | Type | Summary |
---|---|---|
commandType | CommandType | Type of the command to create |
Performs applicarion-defined tasks associated with freeing, releasing, or reseting unmaneged resources.
public Void Dispose()
Executes the specified command against the database.
public Int32 ExecuteCommand(command, dataTable)
Amount of records affected by the command.
If the command returns a set of records, the dataTable parameter must contain an initialized DataTable, otherwise it must be null.
Name | Type | Summary |
---|---|---|
command | IDbCommand | Command to execute |
dataTable | DataTable | An initialized DataTable object or null. |
Executes the specified command asyncronously againt the database.
public Task<Int32> ExecuteCommandAsync(command, dataTable)
If the command returns a set of records, the dataTable parameter must contain an initialized DataTable, otherwise it must be null.
Name | Type | Summary |
---|---|---|
command | IDbCommand | Command to execute |
dataTable | DataTable | An initialized DataTable object or null. |
Executes the specified command against the database and returns a IDataReader.
public IDataReader ExecuteReader(command)
A read only forward only IDataReader with the database data.
Name | Type | Summary |
---|---|---|
command | IDbCommand | Command to execute. |
Executes the specified command against the database asyncronously and returns an IDataReader.
public Task<IDataReader> ExecuteReaderAsync(command)
Name | Type | Summary |
---|---|---|
command | IDbCommand | Command to execute. |
Executes the specified command against the database and returns the first fields of the first record retrieved
public Object ExecuteScalar(command)
Value of the first field of the first record
Name | Type | Summary |
---|---|---|
command | IDbCommand | Command to excecute |
Executes the specified command againts the database asyncronously and returns the first field of the first record retrieved.
public Task<Object> ExecuteScalarAsync(command)
Name | Type | Summary |
---|---|---|
command | IDbCommand | Command to execute. |
Ejecutes the underlaying connection GetSchema() method.
public DataTable GetSchema()
A DataTable as obtained from the GetSchema() method.
Ejecutes the underlaying connection GetSchema() method.
public DataTable GetSchema(collectionName)
A DataTable as obtained from the GetSchema() method.
Name | Type | Summary |
---|---|---|
collectionName | String | The name of the collection to retrieve. |
Ejecutes the underlaying connection GetSchema() method.
public DataTable GetSchema(collectionName, restrictionValues)
A DataTable as obtained from the GetSchema() method.
Name | Type | Summary |
---|---|---|
collectionName | String | The name of the collection to retrieve. |
restrictionValues | String[] | A set of restriction values. |
Gets the server version.
public String GetServerVersion()
The server version.
Helper to raise the InfoMessage event.
protected Void OnInfoMessage(sender, e)
Name | Type | Summary |
---|---|---|
sender | Object | |
e | InfoMessageEventArgs |
Opens a connection with the database server
public Void OpenConnection()
Opens a connection with the database server asyncronously.
public Task OpenConnectionAsync()
Aborts the current transaction
public Void RollbackTransaction()
Writes the specified command to the debug trace with Debug level.
protected Void WriteCommandToDebugTrace(command)
Name | Type | Summary |
---|---|---|
command | IDbCommand | The commnad to write. |
Writes the specified message to the debug trace with Debug level.
protected Void WriteMessageToDebugTrace(message)
Name | Type | Summary |
---|---|---|
message | String | Message to write. |
Writes the specified message to the debug trace with Debug level.
protected Void WriteMessageToDebugTrace(message, stopwatch)
Name | Type | Summary |
---|---|---|
message | String | Message to write. |
stopwatch | Stopwatch | An optional Stopwatch. |
In this document