Class IgniteDbConnection
Ignite database connection.
public sealed class IgniteDbConnection : DbConnection, IComponent, IDbConnection, IDisposable, IAsyncDisposable
- Inheritance
-
IgniteDbConnection
- Implements
- Inherited Members
Constructors
IgniteDbConnection(string?)
Initializes a new instance of the IgniteDbConnection class.
public IgniteDbConnection(string? connectionString)
Parameters
connectionStringstringConnection string.
Properties
Client
Gets the underlying Ignite client instance, or null if the connection is not open.
public IIgniteClient? Client { get; }
Property Value
ConnectionString
When overridden in a derived class, gets or sets the string used to open the connection.
public override string ConnectionString { get; set; }
Property Value
- string
The connection string used to establish the initial connection. The exact contents of the connection string depend on the specific data source for this connection. The default value is an empty string.
DataSource
When overridden in a derived class, gets the name of the database server to which to connect.
public override string DataSource { get; }
Property Value
- string
The name of the database server to which to connect. The default value is an empty string.
Database
When overridden in a derived class, gets the name of the current database after a connection is opened, or the database name specified in the connection string before the connection is opened.
public override string Database { get; }
Property Value
- string
The name of the current database or the name of the database to be used after a connection is opened. The default value is an empty string.
ServerVersion
When overridden in a derived class, gets a string that represents the version of the server to which the object is connected.
public override string ServerVersion { get; }
Property Value
- string
The version of the database. The format of the string returned depends on the specific type of connection you are using.
Exceptions
- InvalidOperationException
ServerVersion was called while the returned Task was not completed and the connection was not opened after a call to System.Data.Common.DbConnection.OpenAsync*.
State
Gets a string that describes the state of the connection.
public override ConnectionState State { get; }
Property Value
- ConnectionState
The state of the connection. The format of the string returned depends on the specific type of connection you are using.
Methods
BeginDbTransaction(IsolationLevel)
When overridden in a derived class, starts a database transaction.
protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
Parameters
isolationLevelIsolationLevelOne of the enumeration values that specifies the isolation level for the transaction to use.
Returns
- DbTransaction
An object representing the new transaction.
BeginDbTransactionAsync(IsolationLevel, CancellationToken)
Asynchronously starts a database transaction.
protected override ValueTask<DbTransaction> BeginDbTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
Parameters
isolationLevelIsolationLevelOne of the enumeration values that specifies the isolation level for the transaction to use.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- ValueTask<DbTransaction>
A task whose Result property is an object representing the new transaction.
ChangeDatabase(string)
When overridden in a derived class, changes the current database for an open connection.
public override void ChangeDatabase(string databaseName)
Parameters
databaseNamestringThe name of the database for the connection to use.
Close()
When overridden in a derived class, closes the connection to the database.
public override void Close()
CreateDbCommand()
When overridden in a derived class, creates and returns a DbCommand object associated with the current connection.
protected override DbCommand CreateDbCommand()
Returns
Dispose(bool)
Releases the unmanaged resources used by the Component and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Open()
When overridden in a derived class, opens a database connection with the settings specified by the ConnectionString.
public override void Open()
Open(IIgniteClient, bool)
Opens the connection using an existing Ignite client.
public void Open(IIgniteClient igniteClient, bool ownsClient = false)
Parameters
igniteClientIIgniteClientIgnite client.
ownsClientboolWhether to dispose the client when the connection is disposed.
OpenAsync(CancellationToken)
This is the asynchronous version of Open(). Providers should override with an appropriate implementation. The cancellation token can optionally be honored.
The default implementation invokes the synchronous Open() call and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by Open will be communicated via the returned Task Exception property.
Do not invoke other methods and properties of the DbConnection object until the returned Task is complete.
public override Task OpenAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task
A task representing the asynchronous operation.
ToString()
Returns a string containing the name of the Component, if any. This method should not be overridden.
public override string ToString()