コード例 #1
0
        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());
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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));
                }
            }
        }