Class AbstractRelationalConnection
Namespace: Mars.Core.Data.Wrapper.Relational
Assembly: Mars.Core.dll
Syntax
public abstract class AbstractRelationalConnection : IDbConnection
Properties
ConnectionString
Gets or sets the string used to open a database.
Declaration
public string ConnectionString { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string containing connection settings. |
ConnectionTimeout
Gets the time to wait while trying to establish a connection before terminating the attempt and generating an
error.
Declaration
public int ConnectionTimeout { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The time (in seconds) to wait for a connection to open. The default value is 15 seconds. |
Database
Gets the name of the current database or the database to be used after a connection is opened.
Declaration
public string Database { get; }
Property Value
Type | Description |
---|---|
System.String | The name of the current database or the name of the database to be used once a connection is open. The default value is an empty string. |
State
Gets the current state of the connection.
Declaration
public ConnectionState State { get; }
Property Value
Type | Description |
---|---|
ConnectionState | One of the System.Data.ConnectionState values. |
Methods
BeginTransaction()
Begins a database transaction.
Declaration
public IDbTransaction BeginTransaction()
Returns
Type | Description |
---|---|
IDbTransaction | An object representing the new transaction. |
BeginTransaction(IsolationLevel)
Begins a database transaction with the specified System.Data.IsolationLevel value.
Declaration
public IDbTransaction BeginTransaction(IsolationLevel il)
Parameters
Type | Name | Description |
---|---|---|
IsolationLevel | il | One of the System.Data.IsolationLevel values. |
Returns
Type | Description |
---|---|
IDbTransaction | An object representing the new transaction. |
ChangeDatabase(String)
Changes the current database for an open Connection object.
Declaration
public void ChangeDatabase(string databaseName)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseName | The name of the database to use in place of the current database. |
Close()
Closes the connection to the database.
Declaration
public void Close()
CreateCommand()
Creates and returns a Command object associated with the connection.
Declaration
public IDbCommand CreateCommand()
Returns
Type | Description |
---|---|
IDbCommand | A Command object associated with the connection. |
CreateConnection()
Creates the database-specific connection
Declaration
protected abstract IDbConnection CreateConnection()
Returns
Type | Description |
---|---|
IDbConnection |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Open()
Opens a database connection with the settings specified by the ConnectionString property of the
provider-specific Connection object.
Declaration
public void Open()