Cross join using selfservicing for .Net 2.0

Posts   
 
    
Levente
User
Posts: 4
Joined: 17-Sep-2009
# Posted on: 17-Sep-2009 13:50:42   

Hi support team,

I am using LLBLGen 2.6 and would like to know if there is a way for a simple cross join. I'm having 2 tables with 2 fields each and would like to get these cross joined together (using selfservicing two class scenario), but unfortunately I can't find any help in the documentation.

P.S. The 2 tables have no field in common, so I cannot do it via normal relations.

Thanks in advance for your help!

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 17-Sep-2009 21:54:45   

Sorry - this is not supported. Joins always have to be on a field.

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 18-Sep-2009 10:24:45   

This is supported, sorry to correct Matt. simple_smile

Cross-joins are supported by specifying the Joinhint.Cross when adding the relation to the relationcollection. There's an overload which allows you to specify a joinhint. In 2.6, you can create a DynamicRelation object between two entities, and you can leave the predicate (on clause) null, and then add it to the relationcollection to get a cross join.

Frans Bouma | Lead developer LLBLGen Pro
Levente
User
Posts: 4
Joined: 17-Sep-2009
# Posted on: 18-Sep-2009 10:31:03   

Thanks guys for the quick response. It is just a little bit weird for me that there is no easier way of doing this. Anyway, thanks for the help and I have to test this ... right now simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 18-Sep-2009 10:38:43   

Levente wrote:

Thanks guys for the quick response. It is just a little bit weird for me that there is no easier way of doing this. Anyway, thanks for the help and I have to test this ... right now simple_smile

well, if you have a relation generated between two entities, it's easy, just add that one to the relationcollection and specify JoinHint.Cross in the Add overload. As you said there's no relation between the two entities, you have to create a dynamic relation. (or use linq wink )

Frans Bouma | Lead developer LLBLGen Pro
Levente
User
Posts: 4
Joined: 17-Sep-2009
# Posted on: 18-Sep-2009 13:12:15   

Otis wrote:

This is supported, sorry to correct Matt. simple_smile

Cross-joins are supported by specifying the Joinhint.Cross when adding the relation to the relationcollection. There's an overload which allows you to specify a joinhint. In 2.6, you can create a DynamicRelation object between two entities, and you can leave the predicate (on clause) null, and then add it to the relationcollection to get a cross join.

Worked like a charm! Thanks guys.