This is a migrated thread and some comments may be shown as answers.

count in projection

1 Answer 69 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jay
Top achievements
Rank 1
Jay asked on 24 Sep 2009, 03:57 PM
When I use the count method I see a warning that it's obsolete and that it should be moved into the projection so that the calculation is done on the server side.  What should that look like?

Scope.Extent<Story>().Count(a => a.Publish); 

Thanks

1 Answer, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 29 Sep 2009, 02:00 PM
Hello Ben Friedman,

We have made improvements in Linq regarding the types of queries that you reported. There are some old warnings left as the one you are getting. Therefore, the warning you are getting is an 'obsolete' one itself. We have removed the obsolete warnings so you will not see those in the next versions of OpenAccess. The query you are executing is pushed properly to the server. Before supporting such queries, the form of your query would have been like:
var query = scope.Extent<Story>().Where(a=>a.Publish).Count(); 

If you write it in this form, the warning you are getting should not be there anymore.

Greetings,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
LINQ (LINQ specific questions)
Asked by
Jay
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Share this question
or