I have the following Nhibernate LINQ query:
var query = from c in session.Query<Customer>()
where
c.EmailAddress == customer.EmailAddress ||
(
c.Address1 == customer.Address1 &&
c.City == customer.City &&
c.State == customer.State &&
c.Postal == customer.Postal &&
c.FirstName == customer.FirstName &&
c.LastName == customer.LastName
)
select c;
I expected the resulting SQL statement to look like:
select
...
from
dbo.Customers customer0_
where
customer0_.EmailAddress=@p0 or
(
customer0_.Address1=@p1
and customer0_.City=@p2
and customer0_.State=@p3
and customer0_.Postal=@p4
and customer0_.FirstName=@p5
and customer0_.LastName=@p6;
)
But what I see from the debug log is:
select
...
from
dbo.Customers customer0_
where
customer0_.EmailAddress=@p0
or customer0_.Address1=@p1
and customer0_.City=@p2
and customer0_.State=@p3
and customer0_.Postal=@p4
and customer0_.FirstName=@p5
and customer0_.LastName=@p6;
Notice there is no grouping on the address part of the where clause. Is this intentional? Should I be formatting my query a different way, or is this a bug?