• DataStax Enterprise C# Driver API Documentation

    Show / Hide Table of Contents
    • Dse
      • AggregateMetadata
      • AlreadyExistsException
      • AtomicMonotonicTimestampGenerator
      • AtomicMonotonicWinApiTimestampGenerator
      • AuthenticationException
      • BatchStatement
      • BatchType
      • BigIntegerTypeAdapter
      • BoundStatement
      • Builder
      • BusyPoolException
      • CassandraConnectionStringBuilder
      • ClientOptions
      • Cluster
      • ColumnDesc
      • ColumnTypeCode
      • CompressionType
      • Configuration
      • ConsistencyLevel
      • ConstantReconnectionPolicy
      • ConstantSpeculativeExecutionPolicy
      • CqlColumn
      • CustomColumnInfo
      • DataCollectionMetadata
      • DataCollectionMetadata.SortOrder
      • DCAwareRoundRobinPolicy
      • DecimalTypeAdapter
      • DefaultRetryPolicy
      • Diagnostics
      • DowngradingConsistencyRetryPolicy
      • DriverException
      • DriverInternalError
      • DseCluster
      • DseClusterBuilder
      • DseConfiguration
      • DseLoadBalancingPolicy
      • Duration
      • DynamicCompositeTypeAdapter
      • EC2MultiRegionTranslator
      • ExecutionException
      • ExecutionInfo
      • ExponentialReconnectionPolicy
      • Extensions
      • FallthroughRetryPolicy
      • FixedReconnectionPolicy
      • FunctionFailureException
      • FunctionMetadata
      • Host
      • HostDistance
      • HostsEventArgs
      • HostsEventArgs.Kind
      • HostsEventHandler
      • IAddressTranslator
      • IAuthenticator
      • IAuthProvider
      • IAuthProviderNamed
      • ICluster
      • IColumnInfo
      • IdempotenceAwareRetryPolicy
      • IDseCluster
      • IDseSession
      • IExecutionProfile
      • IExecutionProfileBuilder
      • IExecutionProfileOptions
      • IExtendedRetryPolicy
      • IFrameCompressor
      • IInitializer
      • ILoadBalancingPolicy
      • IndexMetadata
      • IndexMetadata.IndexKind
      • InvalidConfigurationInQueryException
      • InvalidQueryException
      • InvalidTypeException
      • IReconnectionPolicy
      • IReconnectionSchedule
      • IRetryPolicy
      • IsBootstrappingException
      • ISession
      • ISessionState
      • ISpeculativeExecutionPlan
      • ISpeculativeExecutionPolicy
      • IStatement
      • ITimestampGenerator
      • ITypeAdapter
      • KeyspaceMetadata
      • KeyType
      • ListColumnInfo
      • LocalDate
      • LocalTime
      • Logger
      • LoggingRetryPolicy
      • MapColumnInfo
      • MaterializedViewMetadata
      • Metadata
      • MetadataSyncOptions
      • MetricsExtensions
      • MonitorReportingOptions
      • NoHostAvailableException
      • NoneAuthProvider
      • NoSpeculativeExecutionPolicy
      • NullTypeAdapter
      • OperationTimedOutException
      • OverloadedException
      • PlainTextAuthProvider
      • Policies
      • PoolingOptions
      • PreparedQueryNotFoundException
      • PreparedStatement
      • PreparedStatementIdMismatchException
      • ProtocolErrorException
      • ProtocolOptions
      • ProtocolVersion
      • QueryExecutionException
      • QueryOptions
      • QueryProtocolOptions
      • QueryProtocolOptions.QueryFlags
      • QueryTimeoutException
      • QueryTrace
      • QueryTrace.Event
      • QueryValidationException
      • ReadFailureException
      • ReadTimeoutException
      • RegularStatement
      • ReplicationStrategies
      • RequestInvalidException
      • RetryDecision
      • RetryDecision.RetryDecisionType
      • RetryLoadBalancingPolicy
      • RetryLoadBalancingPolicyEventArgs
      • RoundRobinPolicy
      • RoutingKey
      • Row
      • RowSet
      • RowSetMetadata
      • SchemaChangedEventArgs
      • SchemaChangedEventArgs.Kind
      • SchemaChangedEventHandler
      • ServerErrorException
      • Session
      • SetColumnInfo
      • SimpleStatement
      • SocketOptions
      • SSLOptions
      • Statement
      • SyntaxError
      • TableColumn
      • TableMetadata
      • TableOptions
      • TimeUuid
      • TokenAwarePolicy
      • ToManyConnectionsPerHost
      • TraceRetrievalException
      • TruncateException
      • TupleColumnInfo
      • TypeAdapters
      • UdtColumnInfo
      • UdtMap
      • UdtMap<T>
      • UdtMappingDefinitions
      • UnauthorizedException
      • UnavailableException
      • Unset
      • WriteFailureException
      • WriteTimeoutException
    • Dse.AppMetrics
      • DriverAppMetricsOptions
    • Dse.AppMetrics.MetricTypes
      • IAppMetricsCounter
      • IAppMetricsGauge
      • IAppMetricsMeter
      • IAppMetricsMetric
      • IAppMetricsTimer
    • Dse.AppMetrics.MetricValues
      • IAppMetricsHistogramValue
      • IAppMetricsMeterValue
      • IAppMetricsMetricWithValue<T>
      • IAppMetricsTimerValue
    • Dse.Auth
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
    • Dse.Auth.Sspi
      • SspiException
    • Dse.Data
      • CqlBatchTransaction
      • CqlCommand
      • CqlConnection
      • CqlDataAdapter
      • CqlParameter
      • CqlParameterCollection
      • CqlProviderFactory
      • CqlReader
    • Dse.Data.Linq
      • AllowFilteringAttribute
      • Batch
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CompactStorageAttribute
      • CounterAttribute
      • CqlArgumentException
      • CqlCommand
      • CqlConditionalCommand<TEntity>
      • CqlDelete
      • CqlFunction
      • CqlInsert<TEntity>
      • CqlLinqNotSupportedException
      • CqlOperator
      • CqlQuery<TEntity>
      • CqlQueryBase<TEntity>
      • CqlQueryExtensions
      • CqlQuerySingleElement<TEntity>
      • CqlScalar<TEntity>
      • CqlToken
      • CqlUpdate
      • IgnoreAttribute
      • ITable
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • SessionExtensions
      • StaticColumnAttribute
      • Table<TEntity>
      • TableAttribute
      • TableType
    • Dse.Geometry
      • GeometryBase
      • LineString
      • Point
      • Polygon
    • Dse.Graph
      • Edge
      • Element
      • GraphNode
      • GraphOptions
      • GraphResultSet
      • GraphStatement
      • IEdge
      • IElement
      • IGraphNode
      • IGraphStatement
      • IPath
      • IProperty
      • IVertex
      • IVertexProperty
      • Path
      • SimpleGraphStatement
      • Vertex
    • Dse.Mapping
      • AppliedInfo<T>
      • ColumnMap
      • Cql
      • CqlQueryOptions
      • IColumnDefinition
      • ICqlBatch
      • ICqlQueryAsyncClient
      • ICqlQueryClient
      • ICqlWriteAsyncClient
      • ICqlWriteClient
      • IMapper
      • IPage<T>
      • ITypeDefinition
      • Map<TPoco>
      • Mapper
      • MappingConfiguration
      • Mappings
      • SortOrder
    • Dse.Mapping.Attributes
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CounterAttribute
      • FrozenAttribute
      • FrozenKeyAttribute
      • FrozenValueAttribute
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • StaticColumnAttribute
      • TableAttribute
    • Dse.Mapping.TypeConversion
      • DefaultTypeConverter
      • EnumStringMapper<T>
      • NullableEnumStringMapper<T>
      • TypeConverter
    • Dse.Mapping.Utils
      • MemberInfoExtensions
    • Dse.Metrics
      • DriverMetricsOptions
      • IDriverMetrics
      • IMetric
      • IMetricsRegistry<TMetric>
      • NodeMetric
      • NodeMetric.Counters
      • NodeMetric.Gauges
      • NodeMetric.Meters
      • NodeMetric.Timers
      • SessionMetric
      • SessionMetric.Counters
      • SessionMetric.Gauges
      • SessionMetric.Meters
      • SessionMetric.Timers
    • Dse.Metrics.Abstractions
      • IDriverCounter
      • IDriverGauge
      • IDriverMeter
      • IDriverMetric
      • IDriverMetricsProvider
      • IDriverTimer
    • Dse.Search
      • DateRange
      • DateRangeBound
      • DateRangePrecision
    • Dse.Serialization
      • CustomTypeSerializer<T>
      • TypeSerializer
      • TypeSerializer<T>
      • TypeSerializerDefinitions
      • UdtSerializer

    Class Cluster

    Implementation of ICluster

    Inheritance
    System.Object
    Cluster
    Implements
    ICluster
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Dse
    Assembly: Dse.dll
    Syntax
    public class Cluster : IInternalCluster, ICluster, IDisposable

    Properties

    Configuration

    Gets the cluster configuration.

    Declaration
    public Configuration Configuration { get; }
    Property Value
    Type Description
    Configuration

    MaxProtocolVersion

    Gets or sets the maximum protocol version used by this driver.

    While property value is maintained for backward-compatibility, use SetMaxProtocolVersion(ProtocolVersion) to set the maximum protocol version used by the driver.

    Protocol version used can not be higher than MaxSupported.

    Declaration
    public static int MaxProtocolVersion { get; set; }
    Property Value
    Type Description
    System.Int32

    Metadata

    Declaration
    public Metadata Metadata { get; }
    Property Value
    Type Description
    Metadata

    Methods

    AllHosts()

    Declaration
    public ICollection<Host> AllHosts()
    Returns
    Type Description
    System.Collections.Generic.ICollection<Host>

    Builder()

    Creates a new Cluster.NewBuilder instance.

    This is a shortcut for new Cluster.NewBuilder()

    .

    Declaration
    public static Builder Builder()
    Returns
    Type Description
    Builder

    the new cluster builder.

    BuildFrom(IInitializer)

    Build a new cluster based on the provided initializer.

    Note that for building a cluster programmatically, Cluster.NewBuilder provides a slightly less verbose shortcut with NewBuilder#Build.

    Also note that that all the contact points provided by initializer must share the same port.

    Declaration
    public static Cluster BuildFrom(IInitializer initializer)
    Parameters
    Type Name Description
    IInitializer initializer

    the Cluster.Initializer to use

    Returns
    Type Description
    Cluster

    the newly created Cluster instance

    Connect()

    Creates a new session on this cluster.

    Declaration
    public ISession Connect()
    Returns
    Type Description
    ISession

    Connect(String)

    Creates a new session on this cluster and using a keyspace an existing keyspace.

    Declaration
    public ISession Connect(string keyspace)
    Parameters
    Type Name Description
    System.String keyspace

    Case-sensitive keyspace name to use

    Returns
    Type Description
    ISession

    ConnectAndCreateDefaultKeyspaceIfNotExists(Dictionary<String, String>, Boolean)

    Creates new session on this cluster, and sets it to default keyspace. If default keyspace does not exist then it will be created and session will be set to it. Name of default keyspace can be specified during creation of cluster object with Cluster.Builder().WithDefaultKeyspace("keyspace_name") method.

    Declaration
    public ISession ConnectAndCreateDefaultKeyspaceIfNotExists(Dictionary<string, string> replication = null, bool durableWrites = true)
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<System.String, System.String> replication

    Replication property for this keyspace. To set it, refer to the ReplicationStrategies class methods. It is a dictionary of replication property sub-options where key is a sub-option name and value is a value for that sub-option.

    Default value is SimpleStrategy with 'replication_factor' = 2

    System.Boolean durableWrites

    Whether to use the commit log for updates on this keyspace. Default is set to true.

    Returns
    Type Description
    ISession

    a new session on this cluster set to default keyspace.

    ConnectAsync()

    Creates a new session on this cluster.

    Declaration
    public Task<ISession> ConnectAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<ISession>

    ConnectAsync(String)

    Creates a new session on this cluster and using a keyspace an existing keyspace.

    Declaration
    public Task<ISession> ConnectAsync(string keyspace)
    Parameters
    Type Name Description
    System.String keyspace

    Case-sensitive keyspace name to use

    Returns
    Type Description
    System.Threading.Tasks.Task<ISession>

    Dispose()

    Declaration
    public void Dispose()

    GetHost(IPEndPoint)

    Declaration
    public Host GetHost(IPEndPoint address)
    Parameters
    Type Name Description
    System.Net.IPEndPoint address
    Returns
    Type Description
    Host

    GetReplicas(Byte[])

    Declaration
    public ICollection<Host> GetReplicas(byte[] partitionKey)
    Parameters
    Type Name Description
    System.Byte[] partitionKey
    Returns
    Type Description
    System.Collections.Generic.ICollection<Host>

    GetReplicas(String, Byte[])

    Declaration
    public ICollection<Host> GetReplicas(string keyspace, byte[] partitionKey)
    Parameters
    Type Name Description
    System.String keyspace
    System.Byte[] partitionKey
    Returns
    Type Description
    System.Collections.Generic.ICollection<Host>

    RefreshSchema(String, String)

    Declaration
    public bool RefreshSchema(string keyspace = null, string table = null)
    Parameters
    Type Name Description
    System.String keyspace
    System.String table
    Returns
    Type Description
    System.Boolean

    RefreshSchemaAsync(String, String)

    Declaration
    public Task<bool> RefreshSchemaAsync(string keyspace = null, string table = null)
    Parameters
    Type Name Description
    System.String keyspace
    System.String table
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    Shutdown(Int32)

    Declaration
    public void Shutdown(int timeoutMs = -1)
    Parameters
    Type Name Description
    System.Int32 timeoutMs

    ShutdownAsync(Int32)

    Declaration
    public Task ShutdownAsync(int timeoutMs = -1)
    Parameters
    Type Name Description
    System.Int32 timeoutMs
    Returns
    Type Description
    System.Threading.Tasks.Task

    Events

    HostAdded

    Declaration
    public event Action<Host> HostAdded
    Event Type
    Type Description
    System.Action<Host>

    HostRemoved

    Declaration
    public event Action<Host> HostRemoved
    Event Type
    Type Description
    System.Action<Host>

    Implements

    ICluster
    System.IDisposable
    Back to top © DataStax, All rights reserved.