sca_tone
sca_tone

Reputation: 200

Nhibernate Linq is null on left join

Is there an easy way to do the following Nhibernate Linq statement

var query = from r in myTable.Query<MyTable>()
            where r.Child == null
            select r

The linq query above produces something similar to

SELECT MyTable.Id FROM MyTable WHERE MyTable.ChildId is null

it doesn't reference the child table and check if the left join is null like the following

SELECT MyTable.Id FROM MyTable 
      LEFT JOIN ChildTable ON MyTable.ChildId = ChildTable.Id
WHERE ChildTable.Id is null

Upvotes: 0

Views: 1089

Answers (1)

Onur Gumus
Onur Gumus

Reputation: 1439

var query = from r in myTable.Query<MyTable>()
        where r.Child.Id == null
        select r

Upvotes: 1

Related Questions