I stumbled over some strange LINQ to SQL behaviour - can anybody shed some light on this?
I want to define a lambda expression and use it in my LINQ statement. The follo
Does Table1
refer to the same namespace? In the first example you're querying against the Table1
objects that are directly under dataContext
, in the second example you're querying against the Table1
objects that is a property of the Table2
objects, and in the last example you're using a anonymous function which fix the issue.
I would look up the type of the Table1
objects that is a property of a Table2
object and compare it to a Table1
object that is connected directly to the dataContext
. My guess is that they differ and your lambda expression is using the type of the object that is connected to the dataContext
.