score:3

Accepted answer

I don't believe that HasValue is recognized by LINQ to Entities beause there is no way to convert that into SQL. Therefore I think in this case, L2E has to execute the query before it can evaluate HasValue. I haven't seen this particular behavior before. I thk you need to find another way to express your nullability test. And i'd be interested to see the SQL.

Here's one interesting idea: http://social.msdn.microsoft.com/Forums/en/csharplanguage/thread/56484ed7-9664-44f4-84a0-69da3901c817

There are all kind of weird behaviors with LINQ around nullables so you have to really pay attention to the results -> http://msdn.microsoft.com/en-us/library/bb738687.aspx

hth julie


Related Articles