I have 14 LINQ queries to resolve in one method. None of them have a base query that I could hang them from as subqueries and then store the results as properties of an anonymous type instance.
Rather than making 14 separate calls to the database, how can I ensure that they are all called in the same operation?
UPDATE
I ended up using a dodgy hack which did the trick. I know that there will ALWAYS be at least one user in the user table, so I ended up using:
var data = (from tmp in DataContext.Users
select new {
Property1 = (from...),
Property2 = (from...),
PropertyN = (from...),
}).First();
UPDATE 2
It has been implied in one of the answers that doing this may create MARS (Multiple Active Result Set) errors. What are these errors (I have never seen one), why do they occur and is there anything wrong the whole premise of this line of questioning? i.e. Am I flawed in my assertion that asking the database to return everything in one go is going to be quicker/more efficient than doing fourteen wholly separate LINQ queries?
UPDATE 3
I think my approach is redundant and from a pragmatic perspective, should be handled differently, either via a stored procedure or some sort of delayed/mixed approach.