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(); } } })); }
public static Task <IdentityResult> TryExecuteBatchAsync(this IMapper mapper, CassandraErrorDescriber errorDescriber, ILogger logger, CassandraQueryOptions options, params Action <ICqlBatch>[] actions) { var batch = mapper .CreateBatch() .WithOptions(options); foreach (var a in actions) { a(batch); } return(TryExecuteAsync(() => mapper.ExecuteAsync(batch), errorDescriber, logger)); }
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); }