/// <summary> /// Executes the query in specified parameter context. /// </summary> /// <param name="session">The session.</param> /// <param name="parameterContext">The parameter context.</param> /// <returns>Query execution result.</returns> public QueryResult <T> ExecuteSequence <T>(Session session, ParameterContext parameterContext) { var newParameterContext = new ParameterContext(parameterContext); foreach (var(parameter, tuple) in TupleParameterBindings) { newParameterContext.SetValue(parameter, tuple); } var recordSetReader = DataSource.GetRecordSetReader(session, newParameterContext); return(Materializer.Invoke <T>(recordSetReader, session, newParameterContext)); }
/// <summary> /// Materializes items from underlying record set. /// </summary> /// <typeparam name="T">The type of items in the resulting sequence.</typeparam> /// <returns><see cref="QueryResult{TItem}"/> representing a sequence to be enumerated.</returns> /// <exception cref="InvalidOperationException">Thrown on attempt to get delayed result outside of transaction /// boundaries.</exception> protected QueryResult <T> Materialize <T>() { if (!LifetimeToken.IsActive) { throw new InvalidOperationException(Strings.ExThisInstanceIsExpiredDueToTransactionBoundaries); } if (Task.Result == null) { Session.ExecuteUserDefinedDelayedQueries(false); } return(materializer.Invoke <T>(RecordSetReader.Create(Task.Result), Session, parameterContext)); }