I've added it now,
http://code.google.com/p/dblinq2007/source/diff?spec=svn1016&r=1016&format=side&path=/trunk/src/DbLinq/Test/Providers/ReadTest.cs

On ReadTest.C12_SelectEmployee_MultiJoinWithWhere()


Giacomo

On Fri, Mar 13, 2009 at 9:37 AM, Pascal Craponne <[email protected]> wrote:

> Do we have a unit test somewhere showing this problem?
> Pascal.
>
> jabber/gtalk: [email protected]
> msn: [email protected]
>
>
>
>
> On Fri, Mar 13, 2009 at 08:58, Giacomo Tesio <[email protected]> wrote:
>
>> As far as I saw, the problem signaled is related to multiple joins and
>> anonymous type handling.
>>
>> During the first example expression tree visit, the *where *node is
>> unable to access the *r* parameter, since it is part of a generated
>> anonymous type containing both *r* and *l*.
>>
>> On a single join query there's no such anonymous type, so the *r* would
>> be reachable.
>>
>>
>> Here the question: why there is such anonymous type?
>> Could such anonymous type be substituted by something more easy to handle?
>> (metatable? if I've understood what they are...)
>> Or could a query optimization (given it's executed in the right moment)
>> scompose the where and move each clausole in the right place?
>>
>>
>> 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