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
-~----------~----~----~----~------~----~------~--~---

Reply via email to