Пример #1
0
        public static ICqlBatch WithOptions(this ICqlBatch batch, CassandraQueryOptions queryOptions)
        {
            return(batch.WithOptions(o =>
            {
                if (queryOptions == null)
                {
                    return;
                }

                if (queryOptions.ConsistencyLevel.HasValue)
                {
                    o.SetConsistencyLevel(queryOptions.ConsistencyLevel.Value);
                }

                if (queryOptions.PageSize.HasValue)
                {
                    o.SetPageSize(queryOptions.PageSize.Value);
                }

                if (queryOptions.TracingEnabled.HasValue)
                {
                    if (queryOptions.TracingEnabled.Value)
                    {
                        o.EnableTracing();
                    }
                    else
                    {
                        o.DisableTracing();
                    }
                }
            }));
        }
Пример #2
0
        public static void ExecuteWithOptions(
            this ICqlBatch batch,
            string cql,
            CassandraQueryOptions queryOptions,
            params object[] args)
        {
            batch.WithOptions(o =>
            {
                if (queryOptions == null)
                {
                    return;
                }

                if (queryOptions.ConsistencyLevel.HasValue)
                {
                    o.SetConsistencyLevel(queryOptions.ConsistencyLevel.Value);
                }

                if (queryOptions.PageSize.HasValue)
                {
                    o.SetPageSize(queryOptions.PageSize.Value);
                }

                if (queryOptions.TracingEnabled.HasValue)
                {
                    if (queryOptions.TracingEnabled.Value)
                    {
                        o.EnableTracing();
                    }
                    else
                    {
                        o.DisableTracing();
                    }
                }
            })
            .Execute(cql, args);
        }