If you have ColumnExpression and friends in the AnalyzeConstant(), it's sure that you won't find any constant in this branch :)But I think (I didn't think too much anyway) that such tests can stay in the AnalyzeConstant() method.
Pascal. jabber/gtalk: [email protected] msn: [email protected] On Fri, Mar 6, 2009 at 11:19, Giacomo Tesio <[email protected]> wrote: > May be I fixed the wrong place: a better approach would be to make > ExpressionOptimizer.AnalyzeConstant() not invoke > ExpressionMutatorExtensions.Evaluate() when the expression should not be > evalued (columnexpression, tableexpression and the so)... > > Let me know if I'm missing something else, otherwise I'll correct the > fix... :-D > > > Giacomo > > > > On Fri, Mar 6, 2009 at 10:53 AM, Giacomo Tesio <[email protected]> wrote: > >> Debugging the bug I've reported (I've to find time to translate the test >> to the northwind db) I've found a strange comunication by exception >> mechanism between the ExpressionMutatorExtensions.Evaluate() and the >> ExpressionOptimizer.AnalyzeConstant() methods. >> >> I've tried to optimize it by reducing the number of prevedible Exceptions >> thown, but since I'm quite new to C# and to Linq, I think that further >> optimization would be possible. >> >> Moreover I could not understand how my change impact to >> SpecialExpression.Execute() (which doesn't catch the exceptions thrown at >> all)... >> >> BTW my test query evalutation time was reduced from 02.0145672 seconds to >> 00.4685040 seconds. >> >> >> Again I can't figure out how to write testcases for such a change... but >> if someone would show me a way, I promise I'll write them, really. >> >> >> Giacomo >> >> On Thu, Mar 5, 2009 at 6:57 PM, Giacomo Tesio <[email protected]> wrote: >> >>> Building the following query I'm getting such an exception in >>> DbLinq\src\DbLinq\Data\Linq\Sugar\Implementation\QueryBuilder.cs >>> >>> var res = from r in db.Roles >>> join l in db.RoleUserLinks on r.Id equals l.cRoleID >>> join us in db.Users on l.cUserID equals us.Id >>> *where r.cRole == "RP00"* >>> select us; >>> >>> BTW moving the where in the initial from query execute with no problem: >>> var res = from r in db.Roles*.Where((r) => r.cRole == >>> "RP00")* >>> join l in db.RoleUserLinks on r.Id equals l.cRoleID >>> join us in db.Users on l.cUserID equals us.Id >>> select us; >>> >>> I'm try to debug the problem but with no success: >>> >>> protected virtual void CompileRowCreator(BuilderContext >>> builderContext) >>> { >>> var reader = builderContext.CurrentSelect.Reader; >>> reader = >>> (LambdaExpression)SpecialExpressionTranslator.Translate(reader); >>> reader = >>> (LambdaExpression)ExpressionOptimizer.Optimize(reader, builderContext); >>> builderContext.ExpressionQuery.RowObjectCreator = * >>> reader.Compile()*; >>> } >>> >>> Exception is thrown from reader.Compile(), but I can't understand the >>> difference between the two queries... >>> >>> What am I missing? >>> >>> >>> Giacomo >>> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DbLinq" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/dblinq?hl=en -~----------~----~----~----~------~----~------~--~---
