Entity Framework Generates Weird SQL
If you ever see Entity Framework code that looks something like this:
SELECT 1 AS [C1], CAST(NULL AS int) AS [C2], CAST(NULL AS int) AS [C3], CAST(NULL AS varchar(1)) AS [C4] FROM ( SELECT 1 AS X ) AS [SingleRowTable1] WHERE 1 = 0
and your EF LINQ query was nothing like it (and who’s would be?), then you probably have a
in your query and the collection “somelist” is empty.
I hit this today and was scratching my head until I found this:
Hope that helps someone.