<DatabaseCodeName>_Base class

An abstract class that represents a database connection. Provides methods to manage transactions and other DB related operations. The class also includes properties to access objects that represent tables and views.

Do not change this file manually. Modify the <DatabaseCodeName> class if you need to add or change some functionality.

Constructors


C#:
protected <DatabaseCodeName>_Base();

VB.NET:
Protected Sub New()

Description

Initializes a new instance of the <DatabaseCodeName>_Base class and opens the database connection.

Parameters

None

C#:
protected <DatabaseCodeName>_Base(
bool init
);

VB.NET:
Protected Sub New( _
init As Boolean _
)

Description

Initializes a new instance of the <DatabaseCodeName>_Base class.

Parameters

init

Specifies whether the constructor calls the method to initialize the database connection.

Properties


C#:
public System.Data.IDbConnection Connection {get;}

VB.NET:
Public ReadOnly Property Connection As System.Data.IDbConnection

Description

Gets System.Data.IDbConnection associated with this object.

C#:
public <TableCodeName>Collection <TableCodeName>Collection {get;}

VB.NET:
Public ReadOnly Property <TableCodeName>Collection As <TableCodeName>Collection

Description

Gets an object that represents a table or view. This property is generated for every table and view in the database.

Methods


C#:
public System.Data.IDbTransaction BeginTransaction();

VB.NET:
Public Function BeginTransaction() As System.Data.IDbTransaction

Description

Begins a new database transaction.

Parameters

None

Returns

An object representing the new transaction.

C#:
public System.Data.IDbTransaction BeginTransaction(
      System.Data.IsolationLevel isolationLevel
);

VB.NET:
Public Function BeginTransaction( _
      isolationLevel As System.Data.IsolationLevel _
) As System.Data.IDbTransaction

Description

Begins a new database transaction with the specified transaction isolation level.

Parameters

isolationLevel

The transaction isolation level.

Returns

An object representing the new transaction.

C#:
public virtual void Close();

VB.NET:
Public Overridable Sub Close()

Description

Rolls back any pending transactions and closes the DB connection. An application can call the Close method more than one time without generating an exception.

Parameters

None

C#:
public void CommitTransaction();

VB.NET:
Public Sub CommitTransaction()

Description

Commits the current database transaction.

Parameters

None

C#:
protected abstract string CreateCollectionParameterName(
      string baseParamName
);

VB.NET:
Protected MustOverride Function CreateCollectionParameterName( _
      baseParamName As String _
) As String

Description

Creates a .Net data provider specific name that is used by the AddParameter method.

Parameters

baseParamName

The base name of the parameter.

Returns

The full data provider specific parameter name.

C#:
protected abstract System.Data.IDbConnection CreateConnection();

VB.NET:
Protected MustOverride Function CreateConnection() As System.Data.IDbConnection

Description

Creates a new connection to the database.

Parameters

None

Returns

A reference to the System.Data.IDbConnection object.

C#:
internal protected abstract string CreateSqlParameterName(
      string paramName
);

VB.NET:
Friend Protected MustOverride Function CreateSqlParameterName( _
      paramName As String _
) As String

Description

Returns a SQL statement parameter name that is specific for the data provider. For example it returns ? for OleDb provider, or @paramName for MS SQL provider.

Parameters

paramName

The data provider neutral SQL parameter name.

Returns

The SQL statement parameter name.

C#:
public virtual void Dispose();

VB.NET:
Public Overridable Sub Dispose()

Description

Rolls back any pending transactions and closes the DB connection.

Parameters

None

C#:
internal protected virtual System.Data.IDataReader ExecuteReader(
      System.Data.IDbCommand command
);

VB.NET:
Friend Protected Overridable Function ExecuteReader( _
      command As System.Data.IDbCommand _
) As System.Data.IDataReader

Description

Creates System.Data.IDataReader for the specified DB command.

Parameters

command

The object.

Returns

A reference to the System.Data.IDataReader object.

C#:
protected void InitConnection();

VB.NET:
Protected Sub InitConnection()

Description

Initializes the database connection.

Parameters

None

C#:
public void RollbackTransaction();

VB.NET:
Public Sub RollbackTransaction()

Description

Rolls back the current transaction from a pending state.

Parameters

None