/// <summary> /// Serialize query results as collection of elements of type <typeparamref name="T"/> /// </summary> /// <typeparam name="T"></typeparam> /// <returns>Query result</returns> public IEnumerable <T> As <T>() where T : class { IEnumerable <T> result; if (_a.IsEvaluationNeeded) { var cq = _runtime.Tooling.Compile(Sql); using (var t = _a.GetQueryTransaction()) { result = _runtime.DoQuery <T>(cq.Query, cq.Parameters); t.Commit(); } } else { result = _a.Get <IEnumerable <T> >(Sql.Hash(), _description); } if (_a.IsTracingNeeded) { _a.Query(Sql.Hash(), result, _description); } return(result); }
/// <summary>Executes the query represented by a specified expression tree.</summary> /// <param name="expression">An expression tree that represents a LINQ query.</param> /// <returns>The value that results from executing the specified query.</returns> public object Execute(Expression expression) { using (var t = _auxilary.GetQueryTransaction()) { var r = _original.Execute(expression); t.Commit(); return(r); } }
public bool MoveNext() { if (_tran != null) { lock (locker) { if (_tran != null) { _tran = _auxilary.GetQueryTransaction(); } } } var result = _original.MoveNext(); if (!result) { return(false); } _currentIndex++; if (_currentIndex > _indexBeforeReset) { _current = _original.Current; _data.Add(_current.DeepClone()); } return(result); }
/// <summary>Advances the enumerator to the next element of the collection.</summary> /// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns> /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created.</exception> public bool MoveNext() { if (_tran != null) { lock (locker) { if (_tran != null) { _tran = _auxilary.GetQueryTransaction(); } } } return(_original.MoveNext()); }