O'Reilly logo

Essential ADO.NET by Bob Beauchemin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.5. Implementing the Connection Class

To implement the Connection class, you start by implementing IDbConnection, shown in Listing 8-2. Note that IDbConnection inherits from IDisposable.

Listing 8-2. The IDbConnection interface
public interface IDbConnection : IDisposable
{
  IDbTransaction BeginTransaction(IsolationLevel iso);
  IDbTransaction BeginTransaction();
  bool ChangeDatabase(string newdb);
  void Close();
  IDbCommand CreateCommand();
  void Open();

// properties
 string ConnectionString {get; set;}
 int ConnectionTimeout {get; set;}
 string Database {get; set;}
 ConnectionState State {get;}
}

8.5.1. Specification

IDbConnection has six public methods. The most obvious are Open and Close. Because the .NET runtime does not include the concept of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required