/// <summary> /// Determine the number of records that exist by filter. /// </summary> /// <param name="tableName">The name of the table.</param> /// <param name="filter">Expression.</param> /// <returns>The number of records.</returns> public long Count(string tableName, Expression filter) { if (String.IsNullOrEmpty(tableName)) { throw new ArgumentNullException(nameof(tableName)); } DataTable result = Query(MysqlHelper.CountQuery(tableName, _CountColumnName, filter)); if (result != null && result.Rows.Count > 0 && result.Rows[0].Table.Columns.Contains(_CountColumnName) && result.Rows[0][_CountColumnName] != null && result.Rows[0][_CountColumnName] != DBNull.Value) { return(Convert.ToInt64(result.Rows[0][_CountColumnName])); } return(0); }