IAbstractConnection Interface

From RemObjects Software

Jump to: navigation, search

This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.



Overview (.NET)

Data Abstract allows uniform use of connections established using different ADO.NET providers through the use of the IAbstractConnection interface.

You acquire an abstract connection interface through the use of the ConnectionManager.AcquireConnection method. When you are done using it, you release it using the ConnectionManager.ReleaseConnection method.

The methods and properties of IAbstractConnection allow you to work with transactions, create new data readers, execute commands and do several useful operations. Refer to each individual property and method for more information about the functionality offered by this interface.

The BaseConnection Class provides one implementation of this interface used by Data Abstract's drivers.

Namespace

Declaration (C#)

public interface IAbstractConnection : IDisposable;

Hierarchy

  • IDisposable
    • RemObjects.DataAbstract.Server.IAbstractConnection

Properties

Property
Type
Description
Connected Boolean Indicates if the connection is currently open and connected to a database.
ConnectionString String Returns the Data Abstract connection string used by the connection.
CurrentTransaction IDbTransaction Interface Returns a reference to the current transaction object.

IAbstractConnection provides three useful methods to work with transactions: BeginTransaction, CommitTransaction and RollbackTransaction. While a transaction object is still created internally, Data Abstract for .NET doesn't force you to keep a separate reference to it. This property allows you to access the transaction object the connection holds internally.

DatabaseProfile DatabaseProfile A reference to the DatabaseProfile object to which connection refers.
DataProviderInfo DataProviderInfo A reference to the DataProviderInfo this connection references.
DataProviderParams CaseInsensitiveNameValueCollection Contains a list of driver-specific parameters for this connection.

Depending on the used driver, these parameters can be used to specify additional information such as the database sub-type, SQL language dialect or network protocol.

DriverName String Contains the name of the driver that makes this connection to the underlying database.
InTransaction Boolean Returns whether the connection is currently within the contact of a transaction or not.
Name String Returns the name of the connection, as specified in the .daConnection file.
Password String Indicates the Password that is used to connect to the database.

If the database in question uses authentication, UserID and Password will need to match a login set up on your database server.

TransactionCount Integer
UserID String Indicates the UserID or Login Name that is used to connect to the database. If the database in question uses authentication, UserID and Password will need to match a login set up on your database server.


Methods

Method
Description
BeginTransaction Starts a new transaction on the database server that will be used for all subsequent modifications.

The transaction will remain open until either CommitTransaction is called to commit the changes to the database or RollBackTransaction is called to abandon the changes. Note: If you are using a DataAbstractService to implement your middle tier server, transactions will be started and committed/rolled back for you automatically.

Close Closes the connection by dropping the physical connection to the database server or returning it to the connection pool.
CommitTransaction Commits a transaction that was started with a previous call to BeginTransaction and persists the changes to the database.

Note: If you are using a DataAbstractService to implement your middle tier server, transactions will be started and committed/rolled back for you automatically.

GetCommandParams Returns meta data information of all parameters required for a stored procedure or SQL command.
GetDatabaseNames
GetForeignKeys
GetLastAutoInc Returns the last value assigned to an AutoInc field by this connection.
GetStoredProcedureNames Returns a list of all stored procedures defined in the connected database.
GetTableFields Returns meta data information of all fields defined for a given table in the connected database.
GetTableNames Returns a list of all tables defined in the connected database.
GetViewNames Returns a list of all views defined in the connected database.
NewCommand Returns a new IDbCommand object that can be used to execute the specified SQL statement.

Depending on the CommandType, the statement can either be a full SQL statement, or the name of a Stored Procedure contained in the database.

NewDataReader Returns a new DataReader class that can be used to read the data returned by the passed SQL statement.
NewDataTable Creates a new DataTable and fills it with the data returned by the specified SQL statement.
Open Opens the connection by establishing a physical connection to the database server.
RollbackTransaction Rolls back a transaction that was started with a previous call to BeginTransaction and abandons the changes without applying them to the database.

Note: If you are using a DataAbstractService to implement your middle tier server, transactions will be started and committed/rolled back for you automatically.


See Also


Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)

ListsGlossaryFeaturesHow ToDriversComponentsToolsSamplesArticlesArchitectureIssues

Personal tools