PS: I've tried both approach (multitable MetaTableExpression and nested
MetaTableExpression).

Both could work, but the the structure of the anonymous types generated by
the expression tree parser, would make the multitable way too complex and
convoluted, while the nested solution appeared to be really fast and clean
given the current code.

So I've committed the nesting one (even becouse the other would have
required a lot more code and test to be completed).


That let me focus about the fact that understanding the code interactions
required far more time than to localize and fix the bug.
Can someone write one or more sequence diagrams for the DbLinq core?
It would help a lot!


Giacomo



On Mon, Mar 23, 2009 at 8:41 AM, Giacomo Tesio <[email protected]> wrote:

> Fixed in http://code.google.com/p/dblinq2007/source/detail?r=1019
>
> AFAIK, there's no regression in the unit tests, but I'd prefer if someone
> could run all the tests.
>
> I've changed the MetaTableExpression.Aliases dictionary to contain
> MutableExpressions instead of just TableExpression.
>
> May be a better approach would have been to make both TableExpression and
> MetaTableExpression derive from the same (empty) class, and use such a class
> as the dictionary entry.
>
> This would make the commented checks in the MetaTableExpression constructor
> unuseful (
> http://code.google.com/p/dblinq2007/source/browse/trunk/src/DbLinq/Data/Linq/Sugar/Expressions/MetaTableExpression.cs?spec=svn1019&r=1019
> )
> I've commented it out since the class is internal and used from limited
> points, but actually they would be right.
>
>
> If someone help me to find a good name (and location) for the utility class
> from which to derive TableExpression and MetaTableExpression, I'll correct
> the fix.
>
>
> Giacomo
>
>
>
>
>
> On Fri, Mar 20, 2009 at 5:54 PM, Pascal Craponne <[email protected]> wrote:
>
>> The MetaTable was created to match the Expressions that create anonymous
>> types with two table types. I'm not sure there's any expression creating an
>> anonymous type with more than 2 tables, so I suggest the second option.But 
>> I'm not in the code right now, so you can tell what's best :)
>>
>> Pascal.
>>
>> jabber/gtalk: [email protected]
>> msn: [email protected]
>>
>>
>>
>> On Fri, Mar 20, 2009 at 16:43, Giacomo Tesio <[email protected]> wrote:
>>
>>> Ok... so we need
>>> - to refactor it to become "an internal object that associates N tables
>>> with some relations" or
>>> - to create a metatable on each join (after the first join containing
>>> metatables containing the precedents joined table)
>>>
>>> Which do you think would be better?
>>>
>>> Giacomo
>>>
>>>
>>> On Fri, Mar 20, 2009 at 11:22 AM, Pascal Craponne <[email protected]>wrote:
>>>
>>>> Hi Giacomo,
>>>> a MetaTableExpression is an internal object that associates two tables
>>>> with a relation (join).
>>>>
>>>> Pascal.
>>>>
>>>> jabber/gtalk: [email protected]
>>>> msn: [email protected]
>>>>
>>>>
>>>>
>>>> On Fri, Mar 20, 2009 at 11:18, Giacomo Tesio <[email protected]> wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> Since I've not yet found the time to deeply understand and fix the bug,
>>>>> can you explain me what's the definition of the metatable concept?
>>>>>
>>>>>
>>>>> I've to understand if it's to be used to fix the problem (actually if
>>>>> the problem is that it's not used or updated when the second join is
>>>>> visited).
>>>>>
>>>>>
>>>>> Giacomo
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 13, 2009 at 3:12 PM, Giacomo Tesio <[email protected]>wrote:
>>>>>
>>>>>> 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