Class DataConnection
Represents a connection to a database.
Inheritance
Inherited Members
Namespace: Cuemon.Data
Assembly: Cuemon.Data.dll
Syntax
public abstract class DataConnection : DbConnection, IDbConnection, IDisposable, IDataConnection
Constructors
| Improve this DocDataConnection()
Initializes a new instance of the DataConnection class.
Declaration
protected DataConnection()
DataConnection(String)
Initializes a new instance of the DataConnection class.
Declaration
protected DataConnection(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string used to establish the connection. |
DataConnection(String, String, String, String, String)
Initializes a new instance of the DataConnection class.
Declaration
protected DataConnection(string database, string address, string userId, string password, string networkLibrary)
Parameters
Type | Name | Description |
---|---|---|
System.String | database | The database of the connection. |
System.String | address | The address of the connection. |
System.String | userId | The user id of the connection. |
System.String | password | The password of the connection. |
System.String | networkLibrary | The network library of the connection. |
DataConnection(String, String, String, String, String, TimeSpan)
Initializes a new instance of the DataConnection class.
Declaration
protected DataConnection(string database, string address, string userId, string password, string networkLibrary, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.String | database | The database of the connection. |
System.String | address | The address of the connection. |
System.String | userId | The user id of the connection. |
System.String | password | The password of the connection. |
System.String | networkLibrary | The network library of the connection. |
System.TimeSpan | timeout | The timespan to wait of the connection to open. |
Properties
| Improve this DocAddress
Gets or sets the server address of the connection.
Declaration
public string Address { get; set; }
Property Value
Type | Description |
---|---|
System.String | The server address of the connection. |
ConnectionString
Gets or sets the string used to open the connection.
Declaration
public override string ConnectionString { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
ConnectionTimeout
Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error. Preserved for backward compatibility.
Declaration
public override int ConnectionTimeout { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The time (in seconds) to wait for a connection to open. The value is taken from the Timeout value, and is default 10 seconds. |
Overrides
Database
Gets or sets the database of the connection.
Declaration
public override string Database { get; }
Property Value
Type | Description |
---|---|
System.String | The database of the connection. |
Overrides
NetworkLibrary
Gets or sets the network library of the connection.
Declaration
public string NetworkLibrary { get; set; }
Property Value
Type | Description |
---|---|
System.String | The network library of the connection. |
Password
Gets or sets the password of the connection.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String | The password of the connection. |
State
Gets the current state of the connection.
Declaration
public abstract override ConnectionState State { get; }
Property Value
Type | Description |
---|---|
System.Data.ConnectionState |
Overrides
Timeout
Gets or sets the time to wait while trying to establish a connection before terminating the attempt and generating an error.
Declaration
public TimeSpan Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan | The timespan to wait for a connection to open. The default value is 10 seconds. |
UserId
Gets or sets the user id of the connection.
Declaration
public string UserId { get; set; }
Property Value
Type | Description |
---|---|
System.String | The user id of the connection. |
Methods
| Improve this DocChangeDatabase(String)
Changes the current database for an open Connection object.
Declaration
public abstract override void ChangeDatabase(string databaseName)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseName | The name of the database to use in place of the current database. |
Overrides
Close()
Closes the connection to the database.
Declaration
public abstract override void Close()
Overrides
GetConnectionString(DbConnection)
Renders a connection string from objects with the implemented IDataConnection interface.
Declaration
public static string GetConnectionString(DbConnection dataConnection)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbConnection | dataConnection | The data connection interface. |
Returns
Type | Description |
---|---|
System.String | A connection string. |
Open()
Opens a database connection with the settings specified by the ConnectionString property of the provider-specific Connection object.
Declaration
public abstract override void Open()
Overrides
ToString()
Renders the properties of this class to a connection string (if no "manuel" connectionString has been specified). If ConfigurationElement has been set, values are derived from this object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A connection string. |