C# Class CqlSharp.CqlConnection

A connection to a Cassandra cluster
Inheritance: IDisposable
Datei anzeigen Open project: reuzel/CqlSharp Class Usage Examples

Private Properties

Property Type Description
CompleteOpen void
CqlConnection System
GetConnection Connection
OpenAsyncInternal Task
OpenAsyncInternal2 Task

Public Methods

Method Description
BeginTransaction ( ) : CqlBatchTransaction

Begins the transaction.

BeginTransaction ( IsolationLevel isolationLevel ) : CqlBatchTransaction

Begins the transaction.

Cancel ( ) : void

Cancels any ongoing open operation.

ChangeDatabase ( string databaseName ) : void

Changes the current database for an open connection.

Close ( ) : void

Closes the connection to the database. This is the preferred method of closing any open connection.

CqlConnection ( CqlConnectionStringBuilder config ) : System

Initializes a new instance of the CqlConnection class.

CqlConnection ( string connectionString ) : System

Initializes a new instance of the CqlConnection class.

CreateCqlCommand ( ) : CqlCommand

Creates and returns a T:CqlSharp.CqlCommand object associated with the current connection.

Open ( ) : void

Opens a database connection with the settings specified by the .

OpenAsync ( CancellationToken cancellationToken ) : Task

This is the asynchronous version of M:System.Data.Common.DbConnection.Open. The cancellation token can optionally be honored.The default implementation invokes the synchronous 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.

OpenInternal ( ) : void

Opens the connection with full cancellation support.

SetConnectionTimeout ( int timeout ) : void

Sets the connection timeout.

Shutdown ( string connectionString ) : void

Shutdowns all interaction with the cluster as specified by the connection string.

This will close all open connection, and thereby fail all ongoing cql operations.

ShutdownAll ( ) : void

Shutdowns all interactions with all known clusters

This will close all open connection, and thereby fail all ongoing cql operations.

Protected Methods

Method Description
BeginDbTransaction ( IsolationLevel isolationLevel ) : DbTransaction

Starts a database transaction.

CreateDbCommand ( ) : DbCommand

Creates and returns a T:System.Data.Common.DbCommand object associated with the current connection.

Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the T:System.ComponentModel.Component and optionally releases the managed resources.

Private Methods

Method Description
CompleteOpen ( Logger logger ) : void
CqlConnection ( ) : System

Initializes the CqlConnection class.

GetConnection ( PartitionKey partitionKey = default(PartitionKey) ) : Connection

Requests a connection to be used for a command. Will reuse connection level connection if available

OpenAsyncInternal ( CancellationToken cancellationToken ) : Task

Opens the connection.

OpenAsyncInternal2 ( Logger logger, CancellationToken cancellationToken ) : Task

Opens the connection.

Method Details

BeginDbTransaction() protected method

Starts a database transaction.
protected BeginDbTransaction ( IsolationLevel isolationLevel ) : DbTransaction
isolationLevel IsolationLevel Specifies the isolation level for the transaction.
return DbTransaction

BeginTransaction() public method

Begins the transaction.
public BeginTransaction ( ) : CqlBatchTransaction
return CqlBatchTransaction

BeginTransaction() public method

Begins the transaction.
public BeginTransaction ( IsolationLevel isolationLevel ) : CqlBatchTransaction
isolationLevel IsolationLevel The isolation level.
return CqlBatchTransaction

Cancel() public method

Cancels any ongoing open operation.
public Cancel ( ) : void
return void

ChangeDatabase() public method

Changes the current database for an open connection.
/// CqlConnection must be open before Database can be changed. /// or /// Changing a database is only supported with a ConnectionStrategy that offers exclusive connections ///
public ChangeDatabase ( string databaseName ) : void
databaseName string Specifies the name of the database for the connection to use.
return void

Close() public method

Closes the connection to the database. This is the preferred method of closing any open connection.
public Close ( ) : void
return void

CqlConnection() public method

Initializes a new instance of the CqlConnection class.
public CqlConnection ( CqlConnectionStringBuilder config ) : System
config CqlConnectionStringBuilder The config.
return System

CqlConnection() public method

Initializes a new instance of the CqlConnection class.
public CqlConnection ( string connectionString ) : System
connectionString string The connection string.
return System

CreateCqlCommand() public method

Creates and returns a T:CqlSharp.CqlCommand object associated with the current connection.
public CreateCqlCommand ( ) : CqlCommand
return CqlCommand

CreateDbCommand() protected method

Creates and returns a T:System.Data.Common.DbCommand object associated with the current connection.
protected CreateDbCommand ( ) : DbCommand
return DbCommand

Dispose() protected method

Releases the unmanaged resources used by the T:System.ComponentModel.Component and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool /// true to release both managed and unmanaged resources; false to release only unmanaged /// resources. ///
return void

Open() public method

Opens a database connection with the settings specified by the .
public Open ( ) : void
return void

OpenAsync() public method

This is the asynchronous version of M:System.Data.Common.DbConnection.Open. The cancellation token can optionally be honored.The default implementation invokes the synchronous 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.
Connection must be closed before it is opened
public OpenAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken The cancellation instruction.
return Task

OpenInternal() public method

Opens the connection with full cancellation support.
CqlConnection Open has been aborted by user CqlConnection.Open timed out.
public OpenInternal ( ) : void
return void

SetConnectionTimeout() public method

Sets the connection timeout.
public SetConnectionTimeout ( int timeout ) : void
timeout int The timeout in seconds
return void

Shutdown() public static method

Shutdowns all interaction with the cluster as specified by the connection string.
This will close all open connection, and thereby fail all ongoing cql operations.
public static Shutdown ( string connectionString ) : void
connectionString string The connection string.
return void

ShutdownAll() public static method

Shutdowns all interactions with all known clusters
This will close all open connection, and thereby fail all ongoing cql operations.
public static ShutdownAll ( ) : void
return void