DomainService.Count<T> Method

WCF RIA Services

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Returns the number of rows in an IQueryable.

Namespace:  System.ServiceModel.DomainServices.Server
Assembly:  System.ServiceModel.DomainServices.Server (in System.ServiceModel.DomainServices.Server.dll)

protected virtual int Count<T>(
	IQueryable<T> query

Type Parameters


The element type of the query.


Type: System.Linq.IQueryable<T>
The query for which the count is returned.

Return Value

Type: System.Int32
The total number of rows if total counts are supported; otherwise, -1.

A derived DomainService should override this method to implement support for total counts of paged result sets. Overrides should not call the base method.