IDbAccess

Allows the implementation of database access.

Namespace:
Inetdev.Data
Type:
Interface
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
Yes
Implements:
System.IDisposable

Events

Type Name Summary
InfoMessageEventHandler InfoMessage Occurs when the database engine returns a warning of informational message.

Properties

ApplicationName

Application name (optional).

Signature:
public String ApplicationName { get; set; }

Catalog

Catalog (database name).

Signature:
public String Catalog { get; set; }

ConnectionTimeout

Connection time-out.

Signature:
public Nullable<Int32> ConnectionTimeout { get; set; }

DefaultSchema

Default schema for database objects.

Signature:
public String DefaultSchema { get; set; }

ExtendedConnectionString

Allows to extend the connection string builded from the object.

Signature:
public String ExtendedConnectionString { get; set; }

IsConnectionOpen

Indicates whether the connection is opened.

Signature:
public Boolean IsConnectionOpen { get; }

IsInTransaction

Indicates whether an opened connection is in a transaction.

Signature:
public Boolean IsInTransaction { get; }

MaxPoolSize

Maximum number of elements of the connection pool.

Signature:
public Nullable<Int32> MaxPoolSize { get; set; }

Name

Name of the object.

Signature:
public String Name { get; set; }

Password

Sets the password of the user used to connect to the database.

Signature:
public String Password { set; }

Pooling

Whether connection pooling is enabled or not.

Signature:
public Nullable<Boolean> Pooling { get; set; }

Port

Port where the database server is listening.

Signature:
public Int32 Port { get; set; }

Retries

Specify how many times a failed operation will be retried.

Signature:
public Int32 Retries { get; set; }

ServerName

Server name or it's IP address.

Signature:
public String ServerName { get; set; }

UseConnectionStringBuilder

Name of the connection string builder to use.

Signature:
public String UseConnectionStringBuilder { get; set; }

UseIntegratedSecurity

Gets or sets if integrated database security must be used.

Signature:
public Boolean UseIntegratedSecurity { get; set; }

UserName

Sets the user name used to connect to the database.

Signature:
public String UserName { set; }

Methods

AddParameter

Adds a new parameter to the command passed as parameter

Signature:
public Void AddParameter(command, name, type, direction, value)
Parameters
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

AddParameter

Adds a new parameter to the command passed as parameter

Signature:
public Void AddParameter(command, name, type, direction, size, value)
Parameters
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

BeginTransaction

Initiates a database transaction

Signature:
public IDbTransaction BeginTransaction()
Returns

An object representing the new transaction

BeginTransaction

Initiates a database transaction with the specified isolation level

Signature:
public IDbTransaction BeginTransaction(iso)
Returns

Ann object representing the new transaction

Parameters
Name Type Summary
iso IsolationLevel Isolation level for the transaction

CloseConnection

Closes the database connection if it is opened

Signature:
public Void CloseConnection()

CommitTransaction

Commits the running database transaction

Signature:
public Void CommitTransaction()

CreateCommand

Creates a new database command

Signature:
public IDbCommand CreateCommand(commandType)
Returns

An object representing the newly created command

Parameters
Name Type Summary
commandType CommandType Type of the command to create

ExecuteCommand

Executes the specified command against the database.

Signature:
public Int32 ExecuteCommand(command, dataTable)
Returns

Amount of records affected by the command.

Remarks

If the command returns a set of records, the dataTable parameter must contain an initialized DataTable, otherwise it must be null.

Parameters
Name Type Summary
command IDbCommand Command to execute
dataTable DataTable An initialized DataTable object or null.

ExecuteCommandAsync

Executes the specified command asyncronously againt the database.

Signature:
public Task<Int32> ExecuteCommandAsync(command, dataTable)
Remarks

If the command returns a set of records, the dataTable parameter must contain an initialized DataTable, otherwise it must be null.

Parameters
Name Type Summary
command IDbCommand Command to execute
dataTable DataTable An initialized DataTable object or null.

ExecuteReader

Executes the specified command against the database and returns an IDataReader.

Signature:
public IDataReader ExecuteReader(command)
Returns

A read only forward only IDataReader with the database data.

Parameters
Name Type Summary
command IDbCommand Command to execute.

ExecuteReaderAsync

Executes the specified command against the database asyncronously and returns an IDataReader.

Signature:
public Task<IDataReader> ExecuteReaderAsync(command)
Parameters
Name Type Summary
command IDbCommand Command to execute.

ExecuteScalar

Executes the specified command against the database and returns the first field of the first record retrieved

Signature:
public Object ExecuteScalar(command)
Returns

Value of the first field of the first record

Parameters
Name Type Summary
command IDbCommand Command to excecute

ExecuteScalarAsync

Executes the specified command againts the database asyncronously and returns the first field of the first record retrieved.

Signature:
public Task<Object> ExecuteScalarAsync(command)
Parameters
Name Type Summary
command IDbCommand Command to execute.

GetSchema

Ejecutes the underlaying connection GetSchema() method.

Signature:
public DataTable GetSchema()
Returns

A DataTable as obtained from the GetSchema() method.

GetSchema

Ejecutes the underlaying connection GetSchema() method.

Signature:
public DataTable GetSchema(collectionName)
Returns

A DataTable as obtained from the GetSchema() method.

Parameters
Name Type Summary
collectionName String The name of the collection to retrieve.

GetSchema

Ejecutes the underlaying connection GetSchema() method.

Signature:
public DataTable GetSchema(collectionName, restrictionValues)
Returns

A DataTable as obtained from the GetSchema() method.

Parameters
Name Type Summary
collectionName String The name of the collection to retrieve.
restrictionValues String[] A set of restriction values.

GetServerVersion

Gets the server version.

Signature:
public String GetServerVersion()
Returns

The server version.

OpenConnection

Opens a connection with the database server

Signature:
public Void OpenConnection()

OpenConnectionAsync

Opens a connection with the database server asyncronously.

Signature:
public Task OpenConnectionAsync()

RollbackTransaction

Aborts the current transaction

Signature:
public Void RollbackTransaction()