Exemple #1
0
        public override Task <IRowSet> ExecuteAsync(ref CqlBatch batch)
        {
            if (batch.Commands == null || batch.Commands.Count <= 0)
            {
                throw new ArgumentException("CqlBatch has none commands");
            }

            BatchStatement bst = new BatchStatement();
            ICqlCommand    cmd = null;

            for (int i = 0; i < batch.Commands.Count; i++)
            {
                cmd = batch.Commands[i];
                if (cmd is CqlCommand)
                {
                    var ecmd = (CqlCommand)cmd;
                    switch (ecmd.Type)
                    {
                    case CqlCommandType.Insert:
                        bst.Add(new SimpleStatement(CqlCommandBuilder.BuildInsertEntityCommand(ecmd.Entity, ecmd.CheckExists)));
                        break;

                    case CqlCommandType.Update:
                        bst.Add(new SimpleStatement(CqlCommandBuilder.BuildUpdateEntityCommand(ecmd.Entity, ecmd.CheckExists)));
                        break;

                    case CqlCommandType.Delete:
                        bst.Add(new SimpleStatement(CqlCommandBuilder.BuildDeleteEntityCommand(ecmd.Entity, ecmd.CheckExists)));
                        break;

                    default:
                        throw new NotSupportedException("CassandraTableStore.Execut batch");
                    }
                }
                else
                {
                    throw new NotImplementedException("CassandraTableStore.Execut batch");
                }
            }

            return(ExecuteBatchAsync(bst));
        }
Exemple #2
0
 public abstract Task <IRowSet> ExecuteAsync(ref CqlBatch batch);