Returns the number of records of T in the database

Namespace: Castle.ActiveRecord
Assembly:  Castle.ActiveRecord (in Castle.ActiveRecord.dll)
Version: 1.0.3.0

Syntax

C#
protected internal static int Count(
	string filter,
	params Object[] args
)

Parameters

filter
String
A sql where string i.e. Person=? and DOB > ?
args
array<Object>[]()
Positional parameters for the filter string

Return Value

The count result

Examples

CopyC#
[ActiveRecord]
public class User : ActiveRecordBase<User>
{
  ...

  public static int CountAllUsersLocked()
  {
    return Count("IsLocked = ?", true); // Equivalent to: Count(typeof(User), "IsLocked = ?", true);
  }
}

See Also