score:1

Accepted answer

for cross join just add another from:

from fees in session.query<fee>()
//cross join:
from feetypes in session.query<session.query<fee>()
join ...
join ...
// left join:
join feetypelink in session.query<feetypelink>() on 
new {fees.feeid,feetypes.feetypeid} equals new{feetypelink.feeid,feetypelink.feetypeid} 
into gr
from res in gr.defaultifempty() .....

score:0

you can use this:

from a in ctx.as
join b in ctx.bs on a.id equals b.idofa //inner join for entities without relationships
join c in ctx.cs on 1 equals 1 //inner join with constant condition

score:1

just throw another from in there, since you're not truly "joining" the tables, from a linq perspective.

from fees in session.query<fee>()
join feecategories in session.query<feecategory>() on fees.feecategory.id equals feecategories.id
join feecompanytype in session.query<feecompanytype>() on fees.id equals feecompanytype.fee.id
from feetype in session.query<feetype>()
select ...

score:1

the original query is nonsense and not really doing a cross join

in fact it is equivalent to this

select various a,b,c,d, and e columns 
from fee a 
inner join feecategory b on a.categoryid = b.feecategoryid 
inner join feecompanytype c on a.feeid = c.feeid 
left join feetypelink d on a.feeid = d.feeid 
left join feetype e on e.feetypeid = d.feetypeid 

now you should be able to convert it easily to linq to sql. i don't use that much so will leave others to fill in the details. you don't need anything fancy though.


Related Query