Return Count from Netflix oData Service When the LINQ Count() Method Doesn't Work

Posted by Craig Shoemaker on Stack Overflow See other posts from Stack Overflow or by Craig Shoemaker
Published on 2010-05-13T15:30:16Z Indexed on 2010/05/13 15:34 UTC
Read the original article Hit count: 323

Filed under:
|
|

Is there a way to use a LINQ expression to request a Count query from the Netflix oData service?

The Netflix documentation shows that you can return counts by appending $count to a request for a collection, but a URL like this:

http://netflix.cloudapp.net/Catalog/Genres/$count

Is not generated from an expression like this:

var count = (from g in catalog.Genres select g).Count();

The above code returns an error saying that the Count method is not supported. Is there a way to do this in LINQ, or do I just need to make WebClient request to get the value?

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about OData