public virtual long Count(NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query) { NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (query).Count("count"); q.SetPolymorphic(query.IsPolymorphic()); NeoDatis.Odb.Values values = storageEngine.GetValues(q, -1, -1); System.Decimal count = (System.Decimal)values.NextValues().GetByIndex(0); return(System.Decimal.ToInt64(count)); }