示例#1
0
        private static void RewritePart(string last, RewriteDesign design, int i)
        {
            var args = design.RewriteChain[i].Arguments;

            switch (last)
            {
            case "All": RewriteAll.Rewrite(design, args); return;

            case "Any": RewriteAny.Rewrite(design, args); return;

            case "Contains": RewriteContains.Rewrite(design, args); return;

            case "Count": RewriteCount.Rewrite(design, args); return;

            case "LongCount": RewriteLongCount.Rewrite(design, args); return;

            case "Min": RewriteMin.Rewrite(design, args); return;

            case "Max": RewriteMax.Rewrite(design, args); return;

            case "Average": RewriteAverage.Rewrite(design, args); return;

            case "Aggregate": RewriteAggregate.Rewrite(design, args); return;

            case "Sum": RewriteSum.Rewrite(design, args); return;

            case "ForEach": RewriteForEach.Rewrite(design, args); return;

            case "First": RewriteFirst.Rewrite(design, args); return;

            case "FirstOrDefault": RewriteFirstOrDefault.Rewrite(design, args); return;

            case "Last": RewriteLast.Rewrite(design, args); return;

            case "LastOrDefault": RewriteLastOrDefault.Rewrite(design, args); return;

            case "Single": RewriteSingle.Rewrite(design, args); return;

            case "SingleOrDefault": RewriteSingleOrDefault.Rewrite(design, args); return;

            case "ElementAt": RewriteElementAt.Rewrite(design, args); return;

            case "ElementAtOrDefault": RewriteElementAtOrDefault.Rewrite(design, args); return;

            case "Range": RewriteRange.Rewrite(design, args); return;

            case "Repeat": RewriteRepeat.Rewrite(design, args); return;

            case "Empty": RewriteEmpty.Rewrite(design, args, design.RewriteChain[i].Invocation); return;

            case "Skip": RewriteSkip.Rewrite(design, args); return;

            case "SkipWhile": RewriteSkipWhile.Rewrite(design, args); return;

            case "Take": RewriteTake.Rewrite(design, args); return;

            case "TakeWhile": RewriteTakeWhile.Rewrite(design, args); return;

            case "Reverse": RewriteReverse.Rewrite(design, args); return;

            case "Select": RewriteSelect.Rewrite(design, args); return;

            case "SelectMany": RewriteSelectMany.Rewrite(design, args); return;

            case "Where": RewriteWhere.Rewrite(design, args); return;

            case "Cast": RewriteCast.Rewrite(design, args, design.RewriteChain[i].Invocation); return;

            case "OfType": RewriteOfType.Rewrite(design, args, design.RewriteChain[i].Invocation); return;

            case "Concat": RewriteConcat.Rewrite(design, args); return;

            case "Union": RewriteUnion.Rewrite(design, args); return;

            case "Intersect": RewriteIntersect.Rewrite(design, args); return;

            case "Except": RewriteExcept.Rewrite(design, args); return;

            case "Distinct": RewriteDistinct.Rewrite(design, args); return;

            case "SequenceEqual": RewriteSequenceEqual.Rewrite(design, args); return;

            case "Zip": RewriteZip.Rewrite(design, args); return;

            case "Join": RewriteJoin.Rewrite(design, args); return;

            case "GroupBy": RewriteGroupBy.Rewrite(design, args); return;

            case "GroupJoin": RewriteGroupJoin.Rewrite(design, args); return;

            case "ToArray": RewriteToArray.Rewrite(design, args); return;

            case "ToList": RewriteToList.Rewrite(design, args); return;

            case "ToSimpleList": RewriteToSimpleList.Rewrite(design, args); return;

            case "ToDictionary": RewriteToDictionary.Rewrite(design, args); return;

            case "Unchecked": design.Unchecked = true; return;

            default: throw new NotImplementedException($"Rewrite of {last} not implemented");
            }
        }
示例#2
0
        private static ExpressionSyntax RewriteSimplePart(string last, RewriteDesign design, int i)
        {
            var args = design.RewriteChain[i].Arguments;

            switch (last)
            {
            case "Aggregate": return(RewriteAggregate.SimpleRewrite(design, args));

            case "All": return(RewriteAll.SimpleRewrite(design, args));

            case "Any": return(RewriteAny.SimpleRewrite(design, args));

            case "Average": return(RewriteAverage.SimpleRewrite(design, args));

            case "Sum": return(RewriteSum.SimpleRewrite(design, args));

            case "Count": return(RewriteCount.SimpleRewrite(design, args));

            case "LongCount": return(RewriteLongCount.SimpleRewrite(design, args));

            case "First": return(RewriteFirst.SimpleRewrite(design, args));

            case "FirstOrDefault": return(RewriteFirstOrDefault.SimpleRewrite(design, args));

            case "Last": return(RewriteLast.SimpleRewrite(design, args));

            case "LastOrDefault": return(RewriteLastOrDefault.SimpleRewrite(design, args));

            case "Single": return(RewriteSingle.SimpleRewrite(design, args));

            case "SingleOrDefault": return(RewriteSingleOrDefault.SimpleRewrite(design, args));

            case "ElementAt": return(RewriteElementAt.SimpleRewrite(design, args));

            case "ElementAtOrDefault": return(RewriteElementAtOrDefault.SimpleRewrite(design, args));

            case "Range": RewriteRange.Rewrite(design, args); return(null);

            case "Repeat": RewriteRepeat.Rewrite(design, args); return(null);

            case "Empty": RewriteEmpty.Rewrite(design, args, design.RewriteChain[i].Invocation); return(null);

            case "Skip": RewriteSkip.Rewrite(design, args); return(null);

            case "Take": RewriteTake.Rewrite(design, args); return(null);

            case "Reverse": RewriteReverse.Rewrite(design, args); return(null);

            case "Select": RewriteSelect.Rewrite(design, args); return(null);

            case "Cast": RewriteCast.Rewrite(design, args, design.RewriteChain[i].Invocation); return(null);

            case "ToArray": return(RewriteToArray.SimpleRewrite(design, args));

            case "ToList": return(RewriteToList.SimpleRewrite(design, args));

            case "ToSimpleList": return(RewriteToSimpleList.SimpleRewrite(design, args));

            case "Unchecked": design.Unchecked = true; return(null);

            default: return(null);
            }
        }