// Constructors // ReSharper disable MemberCanBeProtected.Global public SubQuery(ProjectionExpression projectionExpression, TranslatedQuery query, Parameter <Tuple> parameter, Tuple tuple, ItemMaterializationContext context) // ReSharper restore MemberCanBeProtected.Global { this.provider = context.Session.Query.Provider; var tupleParameterBindings = new Dictionary <Parameter <Tuple>, Tuple>(projectionExpression.TupleParameterBindings); var currentTranslatedQuery = query; var outerParameterContext = context.ParameterContext; var parameterContext = new ParameterContext(outerParameterContext); // Gather Parameter<Tuple> values from current ParameterScope for future use. outerParameterContext.SetValue(parameter, tuple); foreach (var tupleParameter in currentTranslatedQuery.TupleParameters) { var value = outerParameterContext.GetValue(tupleParameter); tupleParameterBindings[tupleParameter] = value; parameterContext.SetValue(tupleParameter, value); } this.projectionExpression = new ProjectionExpression( projectionExpression.Type, projectionExpression.ItemProjector, tupleParameterBindings, projectionExpression.ResultAccessMethod); var translatedQuery = new TranslatedQuery( query.DataSource, query.Materializer, query.ResultAccessMethod, tupleParameterBindings, EnumerableUtils <Parameter <Tuple> > .Empty); delayedQuery = new DelayedQuery <TElement>(context.Session, translatedQuery, parameterContext); context.Session.RegisterUserDefinedDelayedQuery(delayedQuery.Task); context.MaterializationContext.MaterializationQueue.Enqueue(MaterializeSelf); }
// Constructors // ReSharper disable MemberCanBeProtected.Global public SubQuery(ProjectionExpression projectionExpression, TranslatedQuery query, Parameter <Tuple> parameter, Tuple tuple, ItemMaterializationContext context) // ReSharper restore MemberCanBeProtected.Global { this.provider = context.Session.Query.Provider; var tupleParameterBindings = new Dictionary <Parameter <Tuple>, Tuple>(projectionExpression.TupleParameterBindings); var currentTranslatedQuery = ((TranslatedQuery <IEnumerable <TElement> >)query); // Gather Parameter<Tuple> values from current ParameterScope for future use. parameter.Value = tuple; foreach (var tupleParameter in currentTranslatedQuery.TupleParameters) { var value = tupleParameter.Value; tupleParameterBindings[tupleParameter] = value; } var parameterContext = new ParameterContext(); using (parameterContext.Activate()) foreach (var tupleParameter in currentTranslatedQuery.TupleParameters) { tupleParameter.Value = tupleParameter.Value; } this.projectionExpression = new ProjectionExpression( projectionExpression.Type, projectionExpression.ItemProjector, tupleParameterBindings, projectionExpression.ResultType); var translatedQuery = new TranslatedQuery <IEnumerable <TElement> >( query.DataSource, (Func <IEnumerable <Tuple>, Session, Dictionary <Parameter <Tuple>, Tuple>, ParameterContext, IEnumerable <TElement> >)query.UntypedMaterializer, tupleParameterBindings, EnumerableUtils <Parameter <Tuple> > .Empty); delayedSequence = new DelayedSequence <TElement>(context.Session, translatedQuery, parameterContext); context.Session.RegisterUserDefinedDelayedQuery(delayedSequence.Task); context.MaterializationContext.MaterializationQueue.Enqueue(MaterializeSelf); }
public Grouping(ProjectionExpression projectionExpression, TranslatedQuery translatedQuery, Parameter <Tuple> parameter, Tuple tuple, TKey key, ItemMaterializationContext context) : base(projectionExpression, translatedQuery, parameter, tuple, context) { Key = key; }