public static Expression<Func<IElement>> ApplySharpView(this Expression<Func<IElement>> expression)
        {
            int scopeLevel = 0;
            Expression<Func<IElement>> rewrittenExpression = new ScopedForEachFinder(scopeLevel).RewriteRoot(expression);

            ChildScopeForEachFinder childScopeFinder;
            while ((childScopeFinder = new ChildScopeForEachFinder()).FindNextScopeForRewriting(rewrittenExpression))
            {
                rewrittenExpression = (Expression<Func<IElement>>)
                                      new ChildScopeRewriterVisitor(scopeLevel,
                                                                    childScopeFinder.ScopeToRewrite,
                                                                    childScopeFinder.Iterator,
                                                                    childScopeFinder.HtmlBuilder).
                                          RewriteScopeToMethodCall(rewrittenExpression);
                scopeLevel++;
            }

            return
                (Expression<Func<IElement>>)
                new IfRewriterVisitor().Rewrite(new SelectHtmlPropertyPathRewriter().Rewrite(rewrittenExpression));
        }
Beispiel #2
0
        public static Expression <Func <IElement> > ApplySharpView(this Expression <Func <IElement> > expression)
        {
            int scopeLevel = 0;
            Expression <Func <IElement> > rewrittenExpression = new ScopedForEachFinder(scopeLevel).RewriteRoot(expression);

            ChildScopeForEachFinder childScopeFinder;

            while ((childScopeFinder = new ChildScopeForEachFinder()).FindNextScopeForRewriting(rewrittenExpression))
            {
                rewrittenExpression = (Expression <Func <IElement> >)
                                      new ChildScopeRewriterVisitor(scopeLevel,
                                                                    childScopeFinder.ScopeToRewrite,
                                                                    childScopeFinder.Iterator,
                                                                    childScopeFinder.HtmlBuilder).
                                      RewriteScopeToMethodCall(rewrittenExpression);
                scopeLevel++;
            }

            return
                ((Expression <Func <IElement> >)
                 new IfRewriterVisitor().Rewrite(new SelectHtmlPropertyPathRewriter().Rewrite(rewrittenExpression)));
        }