/// <summary> /// Return the number of items /// </summary> /// <param name="type">The type.</param> /// <param name="criteria">The criteria.</param> /// <returns></returns> public static int Count(Type type, Criteria criteria) { CheckTypeAtrribute(type); try { criteria.SQLString = ActiveRecordMaster.MakeCountSelect(type); //Commit Filters criteria.IncludeOrderBy = false; criteria.CommitFilters(); object count = ActiveRecordMaster.ExecuteScalarQueryCriteria(type, criteria); return(int.Parse(count.ToString())); } catch (Exception ex) { LogManager.Log("Monty.ActiveRecord", LogCategory.Error, String.Format("Error when tries to execute ActiveRecordBase.Count(type: [{0}])", type), ex); return(0); } }