• DataStax C# Driver for Apache Cassandra API Documentation
Search Results for

    Show / Hide Table of Contents
    • Cassandra
      • AesColumnEncryptionPolicy
      • AesColumnEncryptionPolicy.AesKeyAndIV
      • AggregateMetadata
      • AlreadyExistsException
      • AtomicMonotonicTimestampGenerator
      • AtomicMonotonicWinApiTimestampGenerator
      • AuthenticationException
      • BaseColumnEncryptionPolicy<TKey>
      • BaseColumnEncryptionPolicy<TKey>.ColMetadataKey
      • BatchStatement
      • BatchType
      • BigIntegerTypeAdapter
      • BoundStatement
      • Builder
      • BusyPoolException
      • CassandraConnectionStringBuilder
      • ClientOptions
      • Cluster
      • ColumnDesc
      • ColumnEncryptionInvalidTypeError
      • ColumnEncryptionMetadata
      • ColumnTypeCode
      • CompressionType
      • Configuration
      • ConsistencyLevel
      • ConstantReconnectionPolicy
      • ConstantSpeculativeExecutionPolicy
      • CqlColumn
      • CqlVector<T>
      • CustomColumnInfo
      • DCAwareRoundRobinPolicy
      • DataCollectionMetadata
      • DataCollectionMetadata.SortOrder
      • DecimalTypeAdapter
      • DefaultLoadBalancingPolicy
      • DefaultRetryPolicy
      • Diagnostics
      • DowngradingConsistencyRetryPolicy
      • DriverException
      • DriverInternalError
      • Duration
      • DynamicCompositeTypeAdapter
      • EC2MultiRegionTranslator
      • EncryptedValue
      • ExecutionException
      • ExecutionInfo
      • ExponentialReconnectionPolicy
      • Extensions
      • FallthroughRetryPolicy
      • FixedReconnectionPolicy
      • FunctionFailureException
      • FunctionMetadata
      • GraphProtocol
      • Host
      • HostDistance
      • HostsEventArgs
      • HostsEventArgs.Kind
      • HostsEventHandler
      • IAddressTranslator
      • IAuthProvider
      • IAuthenticator
      • ICluster
      • IColumnEncryptionPolicy
      • IColumnInfo
      • IExecutionProfile
      • IExecutionProfileBuilder
      • IExecutionProfileOptions
      • IExtendedRetryPolicy
      • IFrameCompressor
      • IInitializer
      • ILoadBalancingPolicy
      • IReconnectionPolicy
      • IReconnectionSchedule
      • IRequestTracker
      • IRetryPolicy
      • ISession
      • ISessionState
      • ISpeculativeExecutionPlan
      • ISpeculativeExecutionPolicy
      • IStatement
      • ITimestampGenerator
      • ITypeAdapter
      • IdempotenceAwareRetryPolicy
      • IndexMetadata
      • IndexMetadata.IndexKind
      • InitFatalErrorException
      • InvalidConfigurationInQueryException
      • InvalidQueryException
      • InvalidTypeException
      • IsBootstrappingException
      • KeyType
      • KeyspaceMetadata
      • ListColumnInfo
      • LocalDate
      • LocalTime
      • Logger
      • LoggingRetryPolicy
      • MapColumnInfo
      • MaterializedViewMetadata
      • Metadata
      • MetadataSyncOptions
      • MetricsExtensions
      • MonitorReportingOptions
      • NoHostAvailableException
      • NoSpeculativeExecutionPolicy
      • NodeRequestInfo
      • NoneAuthProvider
      • NullTypeAdapter
      • OperationTimedOutException
      • OverloadedException
      • PlainTextAuthProvider
      • Policies
      • PoolingOptions
      • PrepareRequest
      • 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
      • SSLOptions
      • SchemaChangedEventArgs
      • SchemaChangedEventArgs.Kind
      • SchemaChangedEventHandler
      • ServerErrorException
      • Session
      • SessionRequestInfo
      • SetColumnInfo
      • SimpleStatement
      • SocketOptions
      • Statement
      • SyntaxError
      • TableColumn
      • TableMetadata
      • TableOptions
      • TimeUuid
      • ToManyConnectionsPerHost
      • TokenAwarePolicy
      • TraceRetrievalException
      • TruncateException
      • TupleColumnInfo
      • TypeAdapters
      • UdtColumnInfo
      • UdtMap
      • UdtMap<T>
      • UdtMappingDefinitions
      • UnauthorizedException
      • UnavailableException
      • Unset
      • VectorColumnInfo
      • WriteFailureException
      • WriteTimeoutException
    • Cassandra.AppMetrics
      • DriverAppMetricsOptions
    • Cassandra.AppMetrics.MetricTypes
      • IAppMetricsCounter
      • IAppMetricsGauge
      • IAppMetricsMeter
      • IAppMetricsMetric
      • IAppMetricsTimer
    • Cassandra.AppMetrics.MetricValues
      • IAppMetricsHistogramValue
      • IAppMetricsMeterValue
      • IAppMetricsMetricWithValue<T>
      • IAppMetricsTimerValue
    • Cassandra.Data
      • CqlBatchTransaction
      • CqlCommand
      • CqlConnection
      • CqlDataAdapter
      • CqlParameter
      • CqlParameterCollection
      • CqlProviderFactory
      • CqlReader
    • Cassandra.Data.Linq
      • AllowFilteringAttribute
      • Batch
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CompactStorageAttribute
      • CounterAttribute
      • CqlArgumentException
      • CqlCommand
      • CqlConditionalCommand<TEntity>
      • CqlDelete
      • CqlFunction
      • CqlInsert<TEntity>
      • CqlLinqNotSupportedException
      • CqlOperator
      • CqlQueryBase<TEntity>
      • CqlQueryExtensions
      • CqlQuerySingleElement<TEntity>
      • CqlQuery<TEntity>
      • CqlScalar<TEntity>
      • CqlToken
      • CqlUpdate
      • ITable
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • SessionExtensions
      • StaticColumnAttribute
      • TableAttribute
      • TableType
      • Table<TEntity>
    • Cassandra.DataStax.Auth
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
    • Cassandra.DataStax.Auth.Sspi
      • SspiException
    • Cassandra.DataStax.Graph
      • Direction
      • Edge
      • Element
      • ElementMap
      • EnumWrapper
      • FluentGraphStatement
      • GraphNode
      • GraphOptions
      • GraphResultSet
      • GraphStatement
      • IEdge
      • IElement
      • IGraphNode
      • IGraphStatement
      • IPath
      • IProperty
      • IPropertyWithElement
      • IVertex
      • IVertexProperty
      • Path
      • SimpleGraphStatement
      • TEnum
      • Traverser
      • Vertex
    • Cassandra.DataStax.Graph.Internal
      • IGraphSONDeserializer
      • IGraphSONReader
      • IGraphSONSerializer
      • IGraphSONWriter
    • Cassandra.DataStax.Search
      • DateRange
      • DateRangeBound
      • DateRangePrecision
    • Cassandra.Geometry
      • GeometryBase
      • LineString
      • Point
      • Polygon
    • Cassandra.Mapping
      • AppliedInfo<T>
      • ColumnMap
      • Cql
      • CqlQueryOptions
      • IColumnDefinition
      • ICqlBatch
      • ICqlQueryAsyncClient
      • ICqlQueryClient
      • ICqlWriteAsyncClient
      • ICqlWriteClient
      • IMapper
      • IPage<T>
      • ITypeDefinition
      • Map<TPoco>
      • Mapper
      • MappingConfiguration
      • Mappings
      • PrimaryKeyAttribute
      • SortOrder
      • TableNameAttribute
    • Cassandra.Mapping.Attributes
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CounterAttribute
      • FrozenAttribute
      • FrozenKeyAttribute
      • FrozenValueAttribute
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • StaticColumnAttribute
      • TableAttribute
    • Cassandra.Mapping.TypeConversion
      • DefaultTypeConverter
      • EnumStringMapper<T>
      • NullableEnumStringMapper<T>
      • TypeConverter
    • Cassandra.Mapping.Utils
      • MemberInfoExtensions
    • Cassandra.Metrics
      • DriverMetricsOptions
      • IDriverMetrics
      • IMetric
      • IMetricsRegistry<TMetric>
      • NodeMetric
      • NodeMetric.Counters
      • NodeMetric.Gauges
      • NodeMetric.Meters
      • NodeMetric.Timers
      • SessionMetric
      • SessionMetric.Counters
      • SessionMetric.Gauges
      • SessionMetric.Meters
      • SessionMetric.Timers
    • Cassandra.Metrics.Abstractions
      • IDriverCounter
      • IDriverGauge
      • IDriverMeter
      • IDriverMetric
      • IDriverMetricsProvider
      • IDriverTimer
    • Cassandra.OpenTelemetry
      • BuilderExtensions
      • CassandraActivitySourceHelper
      • CassandraInstrumentationOptions
      • OpenTelemetryRequestTracker
    • Cassandra.Serialization
      • CustomTypeSerializer<T>
      • TypeSerializer
      • TypeSerializerDefinitions
      • TypeSerializer<T>
      • UdtSerializer
    • Cassandra.Serialization.Primitive
      • DecimalSerializer

    Class QueryOptions

    Options related to defaults for individual queries.

    Inheritance
    object
    QueryOptions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Cassandra
    Assembly: Cassandra.dll
    Syntax
    public class QueryOptions

    Fields

    DefaultConsistencyLevel

    The default consistency level for queries: ConsistencyLevel.LocalOne. For DataStax Astra, this constant should be ignored as the default is LocalQuorum.

    Declaration
    public const ConsistencyLevel DefaultConsistencyLevel = LocalOne
    Field Value
    Type Description
    ConsistencyLevel

    DefaultPageSize

    The default page size for SELECT queries: 5000.

    Declaration
    public const int DefaultPageSize = 5000
    Field Value
    Type Description
    int

    DefaultRetryOnTimeout

    Default value for RetryOnTimeout

    Declaration
    public const bool DefaultRetryOnTimeout = true
    Field Value
    Type Description
    bool

    DefaultSerialConsistencyLevel

    The default serial consistency level for conditional updates: ConsistencyLevel.Serial.

    Declaration
    public const ConsistencyLevel DefaultSerialConsistencyLevel = Serial
    Field Value
    Type Description
    ConsistencyLevel

    Properties

    RetryOnTimeout

    Gets a value that determines if the client should retry when it didn't hear back from a host within ReadTimeoutMillis.

    DEPRECATED: Instead, use OnRequestError(IStatement, Configuration, Exception, int) to control the behavior when OperationTimedOutException is obtained.

    Declaration
    public bool RetryOnTimeout { get; }
    Property Value
    Type Description
    bool

    Methods

    GetConsistencyLevel()

    The default consistency level used by queries.

    Declaration
    public ConsistencyLevel GetConsistencyLevel()
    Returns
    Type Description
    ConsistencyLevel

    the default consistency level used by queries.

    GetDefaultIdempotence()

    Gets the default idempotence for all queries.

    Declaration
    public bool GetDefaultIdempotence()
    Returns
    Type Description
    bool

    GetPageSize()

    The default page size used by queries.

    Declaration
    public int GetPageSize()
    Returns
    Type Description
    int

    the default page size used by queries.

    GetSerialConsistencyLevel()

    The default serial consistency level used by queries.

    Declaration
    public ConsistencyLevel GetSerialConsistencyLevel()
    Returns
    Type Description
    ConsistencyLevel

    the default serial consistency level used by queries.

    IsPrepareOnAllHosts()

    Determines whether the driver should prepare statements on all hosts in the cluster.

    Declaration
    public bool IsPrepareOnAllHosts()
    Returns
    Type Description
    bool

    IsReprepareOnUp()

    Determines whether the driver should re-prepare all cached prepared statements on a host when its marks that host back up.

    Declaration
    public bool IsReprepareOnUp()
    Returns
    Type Description
    bool

    SetConsistencyLevel(ConsistencyLevel)

    Sets the default consistency level to use for queries.

    The consistency level set through this method will be use for queries that don't explicitely have a consistency level.

    Declaration
    public QueryOptions SetConsistencyLevel(ConsistencyLevel consistencyLevel)
    Parameters
    Type Name Description
    ConsistencyLevel consistencyLevel

    the new consistency level to set as default.

    Returns
    Type Description
    QueryOptions

    this QueryOptions instance

    SetDefaultIdempotence(bool)

    Sets the default idempotence for all queries.

    Declaration
    public QueryOptions SetDefaultIdempotence(bool idempotence)
    Parameters
    Type Name Description
    bool idempotence
    Returns
    Type Description
    QueryOptions

    SetPageSize(int)

    Sets the default page size to use for SELECT queries. The page size set through this method will be use for queries that don't explicitely have a page size.

    Declaration
    public QueryOptions SetPageSize(int pageSize)
    Parameters
    Type Name Description
    int pageSize

    the new page size to set as default. It must be strictly positive but you can use int.MaxValue to disable paging.

    Returns
    Type Description
    QueryOptions

    this QueryOptions instance

    SetPrepareOnAllHosts(bool)

    Sets whether the driver should prepare statements on all hosts in the cluster.

    A statement is normally prepared in two steps: prepare the query on a single host in the cluster; if that succeeds, prepare on all other hosts.

    This option controls whether step 2 is executed. It is enabled by default.

    Declaration
    public QueryOptions SetPrepareOnAllHosts(bool prepareOnAllHosts)
    Parameters
    Type Name Description
    bool prepareOnAllHosts
    Returns
    Type Description
    QueryOptions
    Remarks

    The reason why you might want to disable it is to optimize network usage if you have a large number of clients preparing the same set of statements at startup. If your load balancing policy distributes queries randomly, each client will pick a different host to prepare its statements, and on the whole each host has a good chance of having been hit by at least one client for each statement.

    On the other hand, if that assumption turns out to be wrong and one host hasn't prepared a given statement, it needs to be re-prepared on the fly the first time it gets executed; this causes a performance penalty (one extra roundtrip to resend the query to prepare, and another to retry the execution).

    SetReprepareOnUp(bool)

    Set whether the driver should re-prepare all cached prepared statements on a host when it marks it back up.

    This option is enabled by default.

    Declaration
    public QueryOptions SetReprepareOnUp(bool reprepareOnUp)
    Parameters
    Type Name Description
    bool reprepareOnUp
    Returns
    Type Description
    QueryOptions
    Remarks

    The reason why you might want to disable it is to optimize reconnection time when you believe hosts often get marked down because of temporary network issues, rather than the host really crashing. In that case, the host still has prepared statements in its cache when the driver reconnects, so re-preparing is redundant.

    On the other hand, if that assumption turns out to be wrong and the host had really restarted, its prepared statement cache is empty, and statements need to be re-prepared on the fly the first time they get executed; this causes a performance penalty (one extra roundtrip to resend the query to prepare, and another to retry the execution).

    SetRetryOnTimeout(bool)

    Determines if the client should retry when it didn't hear back from a host within ReadTimeoutMillis.

    DEPRECATED: Instead, use OnRequestError(IStatement, Configuration, Exception, int) to control the behavior when OperationTimedOutException is obtained.

    Declaration
    public QueryOptions SetRetryOnTimeout(bool retry)
    Parameters
    Type Name Description
    bool retry
    Returns
    Type Description
    QueryOptions

    SetSerialConsistencyLevel(ConsistencyLevel)

    Sets the default serial consistency level to use for queries. The serial consistency level set through this method will be use for queries that don't explicitely have a serial consistency level.

    Declaration
    public QueryOptions SetSerialConsistencyLevel(ConsistencyLevel serialConsistencyLevel)
    Parameters
    Type Name Description
    ConsistencyLevel serialConsistencyLevel

    the new serial consistency level to set as default.

    Returns
    Type Description
    QueryOptions

    this QueryOptions instance.

    Back to top © DataStax, All rights reserved.