/// <summary> /// Determine the number of objects of a given type that exist that match the supplied expression. /// </summary> /// <typeparam name="T">Type.</typeparam> /// <param name="expr">Expression.</param> /// <returns>Number of matching records.</returns> public long Count <T>(DbExpression expr) { string tableName = _TypeMetadataMgr.GetTableNameFromType(typeof(T)); Expression e = WatsonORMCommon.DbExpressionConverter(expr); return(_Database.Count(tableName, e)); }
static void CountAge() { Expression e = new Expression("age", Operators.GreaterThan, 25); Console.WriteLine("Age count: " + _Database.Count(_Table, e)); }