Click or drag to resize

ISession Interface

A session holds connections to a Cassandra cluster, allowing it to be queried.

Each session maintains multiple connections to the cluster nodes, provides policies to choose which node to use for each query (round-robin on all nodes of the cluster by default), and handles retries for failed query (when it makes sense), etc...

Session instances are thread-safe and usually a single instance is enough per application. However, a given session can only be set to one keyspace at a time, so one instance per keyspace is necessary.

Namespace:  Dse
Assembly:  Dse (in Dse.dll) Version: 2.9.0
Syntax
C#
public interface ISession : IDisposable

The ISession type exposes the following members.

Properties
  NameDescription
Public propertyBinaryProtocolVersion
Gets the Cassandra native binary protocol version
Public propertyCluster
Gets the cluster information and state
Public propertyIsDisposed
Determines if the object has been disposed.
Public propertyKeyspace
Gets name of currently used keyspace.
Public propertySessionName
Session name. This will be autogenerated if it is not set with WithSessionName(String). This is used as part of the metric bucket name, for example, which can be used to separate metric paths per session.
Public propertyUserDefinedTypes
Gets the user defined type mappings
Top
Methods
  NameDescription
Public methodBeginExecute(IStatement, AsyncCallback, Object)
Begins asynchronous execute operation.
Public methodBeginExecute(String, ConsistencyLevel, AsyncCallback, Object)
Begins asynchronous execute operation
Public methodBeginPrepare
Begins asynchronous prepare operation
Public methodChangeKeyspace
Switches to the specified keyspace.
Public methodCreateKeyspace
Creates new keyspace in current cluster.
Public methodCreateKeyspaceIfNotExists
Creates new keyspace in current cluster. If keyspace with specified name already exists, then this method does nothing.
Public methodDeleteKeyspace
Deletes specified keyspace from current cluster. If keyspace with specified name does not exist, then exception will be thrown.
Public methodDeleteKeyspaceIfExists
Deletes specified keyspace from current cluster. If keyspace with specified name does not exist, then this method does nothing.
Public methodEndExecute
Ends asynchronous execute operation
Public methodEndPrepare
Ends asynchronous prepare operation
Public methodExecute(String)
Executes the provided query.
Public methodExecute(IStatement)
Executes the provided query.
Public methodExecute(String, ConsistencyLevel)
Executes the provided query.
Public methodExecute(String, Int32)
Executes the provided query.
Public methodExecute(String, String)
Executes the provided query with the provided execution profile. The execution profile must have been added previously to the Cluster using WithExecutionProfiles(ActionIExecutionProfileOptions).
Public methodExecute(IStatement, String)
Executes the provided statement with the provided execution profile. The execution profile must have been added previously to the Cluster using WithExecutionProfiles(ActionIExecutionProfileOptions).
Public methodExecuteAsync(IStatement)
Executes a query asynchronously
Public methodExecuteAsync(IStatement, String)
Executes a query asynchronously with the provided execution profile. The execution profile must have been added previously to the Cluster using WithExecutionProfiles(ActionIExecutionProfileOptions).
Public methodGetMetrics
Retrieves the driver metrics for this session.
Public methodPrepare(String)
Prepares the provided query string.
Public methodPrepare(String, IDictionaryString, Byte)
Prepares the query string, sending the custom payload request.
Public methodPrepare(String, String)
Prepares the query on the provided keyspace.
Public methodPrepare(String, String, IDictionaryString, Byte)
Prepares the provided query string asynchronously on the provided keyspace, sending the custom payload as part of the request.
Public methodPrepareAsync(String)
Prepares the provided query string asynchronously.
Public methodPrepareAsync(String, IDictionaryString, Byte)
Prepares the provided query string asynchronously, and sending the custom payload request.
Public methodPrepareAsync(String, String)
Prepares the query asynchronously on the provided keyspace.
Public methodPrepareAsync(String, String, IDictionaryString, Byte)
Prepares the provided query asynchronously on the provided keyspace, sending the custom payload as part of the request.
Public methodWaitForSchemaAgreement(IPEndPoint) Obsolete.
Public methodWaitForSchemaAgreement(RowSet) Obsolete.
Top
Extension Methods
  NameDescription
Public Extension MethodCreateBatchOverloaded. (Defined by SessionExtensions.)
Public Extension MethodCreateBatch(BatchType)Overloaded. (Defined by SessionExtensions.)
Public Extension MethodGetState
Gets a snapshot containing information on the connections pools held by this Client at the current time.

The information provided in the returned object only represents the state at the moment this method was called and it's not maintained in sync with the driver metadata.

(Defined by Extensions.)
Public Extension MethodGetTableTEntity

Extension method used for backward-compatibility, use TableTEntity(ISession) constructor instead.

Creates a new instance of the Linq IQueryProvider that represents a table in Cassandra using the mapping configuration provided.

Fluent configuration or attributes can be used to define mapping information.

(Defined by SessionExtensions.)
Top
See Also

Reference