<p>I am building an ObjectQuery like this:</p>

<pre><code>        string query = "select value obj from Entities.Class as obj " +
                       "where obj.Property = @Value";

        ObjectQuery&lt;Class&gt; oQuery = new ObjectQuery&lt;Class&gt;(query, EntityContext.Instance);
        oQuery.Parameters.Add(new ObjectParameter("Value", someVariable));
</code></pre>

<p>I can now assign this object as a DataSource for a control, or iterate with a foreach loop or even force a materialization to a List, however, I can I count the number of objects that will be returned, without forcing a materialization?</p>

<p>Do I need to create a companion query that will execute a count() or is there a function that will do that for me somewhere?</p>

<p>Thank you.</p>

```
ObjectQuery<T>
```
implements
```
IQueryable<T>
```
, so can't you simply use the extension method:
```
```
int count = oQuery.Count();
```
```
What happens if you execute this? I would have expected the overall query to just do a Count()... (not that I've done much EF...).