How come when I do the following:
var query = from a in OBJ where a.ID == ID select c;
It does it <1second, but once I add the IQueryable function, it increases it to ~3seconds?
var query = (from a in OBJ where a.ID == ID select c).SingleOrDefault();
The same happens when I use FirstOrDefault().
This:
… just represents the query. It doesn’t execute it at all. It should be blazingly quick – not just “less than a second” but “almost immeasurably fast.”
This:
… gets actual data which means it has to execute the query.
In general, LINQ uses deferred execution where possible. This is just one example. Search for LINQ deferred execution and you’ll get loads of hits of articles to read. Dive into whichever one suits your reading style best 🙂