У меня следующий запрос Nhibernate LINQ:
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;
Я ожидал, что результирующий оператор SQL будет выглядеть так:
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;
)
Но из журнала отладки я вижу следующее:
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;
Обратите внимание, что в адресной части предложения where нет группировки.Это намеренно?Должен ли я форматировать свой запрос другим способом, или это ошибка?