what is the different between the two
1)
context.connection.open()
var albums = (from a in context.Albums
where a.id == id
select a);
context.connection.close()
2)
context.connection.open()
var albums = (from a in context.Albums
select a);
context.connection.close()
var result = albums.where((a)=>{a.id == id});
Would it be faster using the first one
The where clause in the second looks to be improper syntax, aside from opening/closing the connection they should evaluate to the same code. That is to say the SQL will be generated and executed when the result set is actually enumerated over.
You could omit the rest of the code and simply write:
or
They will evaluate to the same exact thing when the results are enumerated.