Hi, I know Linq-to-SQL is dead, but anyway, I think this is really basic, I'm just confused about what magic Linq-to-SQL does and doesn't do with regards to the SQL it generates.
If I have built up an Expression tree as "myPredicate", and have something like this:
(from request in DataContext.RequestsTable
select request).Where(myPredicate)
.OrderByDescending(item => item.changeDate)
.Take(10)
is it going to work like the following SQL:
SELECT TOP 10 * FROM RequestsTable
WHERE (<<myPredicate equivalent>>)
ORDER BY ChangeDate DESC
It just seems weird to me because the ".Where()" comes after the "select" in my example code. Does the relative positioning of the "select" and "where()" and "orderby()" affect things?
Alternatively, could I do it all in sql-esque syntax? For example, is there some way to use my WHERE predicate in the alternative syntax, something like this?
(from request in DataContext.RequestsTable
where [somehow inject myPredicate]
order by changeDate descending
select request).Take(10)