Share via


DomainService.Count<T> Method

[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)

Syntax

'Declaration
Protected Overridable Function Count(Of T) ( _
    query As IQueryable(Of T) _
) As Integer
'Usage
Dim query As IQueryable(Of T)
Dim returnValue As Integer

returnValue = Me.Count(query)
protected virtual int Count<T>(
    IQueryable<T> query
)
protected:
generic<typename T>
virtual int Count(
    IQueryable<T>^ query
)
abstract Count : 
        query:IQueryable<'T> -> int 
override Count : 
        query:IQueryable<'T> -> int 
JScript does not support generic types and methods.

Type Parameters

  • T
    The element type of the query.

Parameters

Return Value

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

Remarks

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

See Also

Reference

DomainService Class

System.ServiceModel.DomainServices.Server Namespace