public void AddQuerySourcesRequiringMaterialization(QueryModel queryModel)
            {
                var requiresMaterializationExpressionVisitor
                    = _requiresMaterializationExpressionVisitorFactory
                      .Create(_queryModelVisitor);

                var querySourcesRequiringMaterialization = requiresMaterializationExpressionVisitor
                                                           .FindQuerySourcesRequiringMaterialization(queryModel);

                var groupJoinCompensatingVisitor = new GroupJoinMaterializationCompensatingVisitor();

                groupJoinCompensatingVisitor.VisitQueryModel(queryModel);

                var blockedMemberPushdownCompensatingVisitor = new BlockedMemberPushdownCompensatingVisitor();

                queryModel.TransformExpressions(blockedMemberPushdownCompensatingVisitor.Visit);

                var setResultOperatorsCompensatingVisitor = new SetResultOperatorsCompensatingVisitor(this);

                setResultOperatorsCompensatingVisitor.VisitQueryModel(queryModel);

                _querySourcesRequiringMaterialization.UnionWith(
                    querySourcesRequiringMaterialization
                    .Concat(groupJoinCompensatingVisitor.QuerySources)
                    .Concat(blockedMemberPushdownCompensatingVisitor.QuerySources));
            }
Esempio n. 2
0
        /// <summary>
        ///     Determines all query sources that require materialization.
        /// </summary>
        /// <param name="queryModelVisitor"> The query model visitor. </param>
        /// <param name="queryModel"> The query model. </param>
        public virtual void FindQuerySourcesRequiringMaterialization(
            [NotNull] EntityQueryModelVisitor queryModelVisitor, [NotNull] QueryModel queryModel)
        {
            Check.NotNull(queryModelVisitor, nameof(queryModelVisitor));
            Check.NotNull(queryModel, nameof(queryModel));

            var requiresMaterializationExpressionVisitor
                = _requiresMaterializationExpressionVisitorFactory
                  .Create(queryModelVisitor);

            var querySourcesRequiringMaterialization = requiresMaterializationExpressionVisitor
                                                       .FindQuerySourcesRequiringMaterialization(queryModel);

            var groupJoinCompensatingVisitor = new GroupJoinMaterializationCompensatingVisitor();

            groupJoinCompensatingVisitor.VisitQueryModel(queryModel);

            var optionalCollectionNavigationCompensatingVisitor = new OptionalCollectionNavigationCompensatingVisitor();

            optionalCollectionNavigationCompensatingVisitor.VisitQueryModel(queryModel);

            QuerySourcesRequiringMaterialization.UnionWith(
                querySourcesRequiringMaterialization
                .Concat(groupJoinCompensatingVisitor.QuerySources)
                .Concat(optionalCollectionNavigationCompensatingVisitor.QuerySources));
        }