private Expression ExecuteProjection(ProjectionExpression projection, bool okayToDefer, QueryCommand command, Expression[] values) { okayToDefer &= (this.receivingMember != null && this.policy.IsDeferLoaded(this.receivingMember)); var saveScope = this.scope; ParameterExpression reader = Expression.Parameter(typeof(FieldReader), "r" + nReaders++); this.scope = new Scope(this.scope, reader, projection.Select.Alias, projection.Select.Columns); LambdaExpression projector = Expression.Lambda(this.Visit(projection.Projector), reader); this.scope = saveScope; var entity = EntityFinder.Find(projection.Projector); string methExecute = okayToDefer ? "ExecuteDeferred" : "Execute"; // call low-level execute directly on supplied DbQueryProvider Expression result = Expression.Call(this.executor, methExecute, new Type[] { projector.Body.Type }, Expression.Constant(command), projector, Expression.Constant(entity, typeof(MappingEntity)), Expression.NewArrayInit(typeof(object), values) ); if (projection.Aggregator != null) { // apply aggregator result = DbExpressionReplacer.Replace(projection.Aggregator.Body, projection.Aggregator.Parameters[0], result); } return(result); }
public abstract int ExecuteCommand(QueryCommand query, object[] paramValues);
public abstract IEnumerable <T> ExecuteBatch <T>(QueryCommand query, IEnumerable <object[]> paramSets, Func <FieldReader, T> fnProjector, MappingEntity entity, int batchSize, bool stream);
public abstract IEnumerable <T> ExecuteDeferred <T>(QueryCommand query, Func <FieldReader, T> fnProjector, MappingEntity entity, object[] paramValues);
public abstract IEnumerable <int> ExecuteBatch(QueryCommand query, IEnumerable <object[]> paramSets, int batchSize, bool stream);