1

It seems that LINQ-to-NHibernate and LINQ-to-SQL does not support short-circuit evaluation in where clause of query.

Am I right? Is there any workaround? May it be added to next versions of LINQ-to-NHibernate and LINQ-to-SQL?

for more information plz see followings:

The || (or) Operator in Linq with C#

Why ordinary laws in evaluting boolean expression does not fit into LINQ?

Community
  • 1
  • 1
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126

1 Answers1

0

Huh? In LinqToSql, your c# query in code is converted to an expression tree and then a sql statement. The sql statement is handed to mssqlserver which certainly does do short circuiting.

Also note: mssqlserver does not throw null reference exceptions.

Amy B
  • 108,202
  • 21
  • 135
  • 185
  • according to http://stackoverflow.com/questions/2306302/why-ordinary-laws-in-evaluting-boolean-expression-does-not-fit-into-linq there is some problems with it... – Afshar Mohebi Feb 25 '10 at 07:59
  • Microsoft can't add anything to linq to sql or to sql server to resolve your problem, because it's not occuring in those layers. – Amy B Feb 25 '10 at 17:22