I have the following query
var resources = Db.RESOURCE_Resource
.Include(i => i.RESOURCE_Value.Where(s => s.ApplicatieID == applicationId))
.Include(i => i.RESOURCE_Category)
.Where(w => missingCultureIds.All(a => w.RESOURCE_Value.All(an => an.CultureID != a)));
Besides from wanting to return the items which are returned by the query, I also want to return the count of the list. After this query a few more filters will be implemented on the IQueryable, but I need the count beforehand.
Cant I change the query so it includes the count without it leading to multiple queries? I want the count of all these items, but I want only the data of a couple of items (implemented afterwards with
resources.Skip(pageSize).Take(pageSize*pageNumber)
So I want to generate a query that sends only the reduced list of object, but the count of more objects. I know you can make anonymous types from a collection like
.Select(s => new { property = s.item }
Is it possible to do what I want or do I have to handle this via a stored procedure/table valued function?