public TResult Execute <TResult>(IEnumerable <Query> queries, QueryType queryType) { if (queries == null) { throw new ArgumentNullException(nameof(queries)); } if (this.Options.Store == null) { throw new InvalidOperationException("No schema store found."); } ISchema schema = this.Options.Store.GetSchema(typeof(TResult)); QueryBuffer buffer = new QueryBuffer(schema, queryType); using ISyncSession connection = this.Options.GetSyncSession(); foreach (IBatch batch in this.FilterBatches(queries)) { foreach (IDataReader dataReader in connection.Execute(batch)) { buffer.Insert(dataReader); } } return((TResult)buffer.Commit()); }
public void Execute(IEnumerable <Command> commands) { CommandBuffer buffer = new CommandBuffer(); using ISyncSession session = this.Options.GetSyncSession(); foreach (IBatch batch in this.GetBufferedCommands(commands, buffer)) { foreach (IDataReader reader in session.Execute(batch)) { buffer.Update(reader); } } buffer.Commit(); }
public IEnumerable <QueryReader> Enumerate(IEnumerable <Query> queries) { if (queries == null) { throw new ArgumentNullException(nameof(queries)); } if (this.Options.Store == null) { throw new InvalidOperationException("No schema builder found."); } using ISyncSession connection = this.Options.GetSyncSession(); foreach (IBatch batch in this.FilterBatches(queries)) { foreach (IDataReader reader in connection.Execute(batch)) { yield return(new QueryReader(this.Options.Store, reader)); } } }