Self Join

Posts   
 
    
Posts: 35
Joined: 22-May-2006
# Posted on: 21-Apr-2009 17:00:43   

Hi,

I have a table that I wish to create a self join on the entity in the designer (according to the documentation I can). The PK is DataID and there is a field called ParentID which is a reference as to what owns it, going many child levels deep. In designer I can add the relationship and generate the code, but when I build my project it complains that DataID already exists. When I remove the relationship, everything works.

Any ideas?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 21-Apr-2009 21:27:03   

Please can you post the code of the class that fails to build?

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Apr-2009 10:35:12   

I think this is related to a fix we have released recently for the templates. Please update your templates (for v2.6 that is) with the latest templates archive from the customer area and try again.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 35
Joined: 22-May-2006
# Posted on: 22-Apr-2009 17:03:02   

Thanks! I will try it today.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Apr-2009 17:09:34   

this fix: Fix Templates 2.6 03112009 11-Mar-2009 .NET 2.0+: 1:1 relations with self caused entities to refer to the wrong relations for referrals to the PK side.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 35
Joined: 22-May-2006
# Posted on: 27-Apr-2009 22:36:39   

I downloaded v2.6 and tried the self join in designer. Everything still generates fine, but the code will not compile. The error is that it states there is already a reference of <objectname>. I remove the relation and everything works.

I also tried adding only one side of the relation but that returns a different error when you try and compile the code


Invalid expression term ',' C:\Projects\Momentum.DCAA\Momentum.DCAA.DataLayer\Momentum.DCAA.DataLayer.LivelinkExtended\EntityClasses\DtreeEntity.cs 681 30  Momentum.DCAA.DataLayer.LivelinkExtended
    ) expected  C:\Projects\Momentum.DCAA\Momentum.DCAA.DataLayer\Momentum.DCAA.DataLayer.LivelinkExtended\EntityClasses\DtreeEntity.cs 681 32  Momentum.DCAA.DataLayer.LivelinkExtended
    ; expected  C:\Projects\Momentum.DCAA\Momentum.DCAA.DataLayer\Momentum.DCAA.DataLayer.LivelinkExtended\EntityClasses\DtreeEntity.cs 681 38  Momentum.DCAA.DataLayer.LivelinkExtended
    Invalid expression term ')' C:\Projects\Momentum.DCAA\Momentum.DCAA.DataLayer\Momentum.DCAA.DataLayer.LivelinkExtended\EntityClasses\DtreeEntity.cs 681 38  Momentum.DCAA.DataLayer.LivelinkExtended


Any ideas?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Apr-2009 06:08:18   
  • Please generate code to an empty folder
  • Make sure you reference the correct assemblies, in case you have several LLBLGen versions.
David Elizondo | LLBLGen Support Team
Posts: 35
Joined: 22-May-2006
# Posted on: 28-Apr-2009 06:12:07   

Hi,

I am doing all of that. As I stated the application works perfectly fine when I do not include the self join. If I add the self join, generate the code and then compile in my application I get the errors I stated. Everything is referencing 2.6 assemblies. To be on the safe side I wipe out all of the files in the output directory each time. As long as the self join is not there, everything works...I get the same error if I perform the join in 2.5.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 28-Apr-2009 08:08:00   

Would you please attach the lgp project or a repro one.

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 28-Apr-2009 15:32:43   

Please note that the fix is in the templates, so be sure you use the updated templates simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 35
Joined: 22-May-2006
# Posted on: 28-Apr-2009 15:36:20   

Where do I get the updated templates? I downloaded v2.6 from the download page, shouldn't the new templates be included in the build or is there an update I need to get?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 28-Apr-2009 16:15:24   

btrippindacap wrote:

Where do I get the updated templates? I downloaded v2.6 from the download page, shouldn't the new templates be included in the build or is there an update I need to get?

Yes, if you re-installed the full installer, then you have the templates. I was mentioning for the case if you have a custom template for relations for example. simple_smile

Please attach a repro .lgp file.

Frans Bouma | Lead developer LLBLGen Pro