ComponentOne DataObjects for .NET
Connections and Transactions at Run Time
DataObjects for .NET (Enterprise Edition) > Schema Objects > Connections and Transactions at Run Time

In addition to changing the ConnectionString at run time, you can also set the database connection (and/or transaction) to a pre-created IDbConnection (IDbTransaction) object. Fetching data and updating the database (in Fill and Update methods), DataObjects for .NET creates a database connection and transaction for each schema Connection object, if its DbConnection has not been set. If you need to use a pre-created database connection, set the DbConnection property. To prevent DataObjects for .NET from creating its own connection, it must be set:

If you set the DbConnection to your own IDbConnection object, DataObjects for .NET will not close that database connection automatically – you are responsible for closing it. That is usually done in AfterFetch and AfterUpdate events.

By default, DataObjects for .NET opens a database transaction for each database connection before update.

If you want to use your own transaction object, set the DbTransaction property in or before the BeforeUpdate event.

If you set DbTransaction to your own IDbTransaction object, DataObjects for .NET will not close (commit or roll back) that transaction automatically. You are responsible for committing it in case of success or rolling it back in case of failure, which is usually done in the AfterUpdate event.