コード例 #1
0
            public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
            {
                TransformingVisitor.StringBuilder.Append(".");

                switch (resultOperator)
                {
                case GroupResultOperator group:
                    TransformingVisitor.StringBuilder.Append("GroupBy(");
                    using (TransformingVisitor.StringBuilder.Indent())
                    {
                        TransformingVisitor.Visit(group.KeySelector);
                        TransformingVisitor.StringBuilder.Append(", ");
                        TransformingVisitor.Visit(group.ElementSelector);
                        TransformingVisitor.StringBuilder.Append(")");
                    }

                    break;

                case CastResultOperator cast:
                    TransformingVisitor.StringBuilder.Append("Cast<" + cast.CastItemType.ShortDisplayName() + ">()");
                    break;

                case OfTypeResultOperator ofType:
                    TransformingVisitor.StringBuilder.Append("OfType<" + ofType.SearchedItemType.ShortDisplayName() + ">()");
                    break;

                default:
                    TransformingVisitor.StringBuilder.Append(resultOperator.ToString());
                    break;
                }
            }
コード例 #2
0
            public override void VisitJoinClause(JoinClause joinClause, QueryModel queryModel, GroupJoinClause groupJoinClause)
            {
                if (TransformingVisitor.GenerateUniqueQsreIds)
                {
                    var i = TransformingVisitor.VisitedQuerySources.IndexOf(joinClause);
                    if (i == -1)
                    {
                        i = TransformingVisitor.VisitedQuerySources.Count;
                        TransformingVisitor.VisitedQuerySources.Add(joinClause);
                    }

                    TransformingVisitor.StringBuilder.Append($"join {joinClause.ItemType.ShortDisplayName()} {joinClause.ItemName}{{{i}}} in ");
                }
                else
                {
                    TransformingVisitor.StringBuilder.Append($"join {joinClause.ItemType.ShortDisplayName()} {joinClause.ItemName} in ");
                }

                TransformingVisitor.Visit(joinClause.InnerSequence);
                AppendLine();
                TransformingVisitor.StringBuilder.Append("on ");
                TransformingVisitor.Visit(joinClause.OuterKeySelector);
                TransformingVisitor.StringBuilder.Append(" equals ");
                TransformingVisitor.Visit(joinClause.InnerKeySelector);
            }
コード例 #3
0
 public override void VisitJoinClause(JoinClause joinClause, QueryModel queryModel, GroupJoinClause groupJoinClause)
 {
     TransformingVisitor.StringBuilder.Append($"join {joinClause.ItemType.ShortDisplayName()} {joinClause.ItemName} in ");
     TransformingVisitor.Visit(joinClause.InnerSequence);
     AppendLine();
     TransformingVisitor.StringBuilder.Append("on ");
     TransformingVisitor.Visit(joinClause.OuterKeySelector);
     TransformingVisitor.StringBuilder.Append(" equals ");
     TransformingVisitor.Visit(joinClause.InnerKeySelector);
 }
コード例 #4
0
            private void VisitJoinClauseInternal(JoinClause joinClause)
            {
                joinClause.InnerSequence    = TransformingVisitor.Visit(joinClause.InnerSequence);
                joinClause.OuterKeySelector = TransformingVisitor.Visit(joinClause.OuterKeySelector);

                var oldInsideInnerKeySelector = InsideInnerKeySelector;

                InsideInnerKeySelector      = true;
                joinClause.InnerKeySelector = TransformingVisitor.Visit(joinClause.InnerKeySelector);

                if (joinClause.OuterKeySelector.Type.IsNullableType() &&
                    !joinClause.InnerKeySelector.Type.IsNullableType())
                {
                    joinClause.InnerKeySelector = Expression.Convert(joinClause.InnerKeySelector, joinClause.InnerKeySelector.Type.MakeNullable());
                }

                if (joinClause.InnerKeySelector.Type.IsNullableType() &&
                    !joinClause.OuterKeySelector.Type.IsNullableType())
                {
                    joinClause.OuterKeySelector = Expression.Convert(joinClause.OuterKeySelector, joinClause.OuterKeySelector.Type.MakeNullable());
                }

                InsideInnerKeySelector = oldInsideInnerKeySelector;
            }