/// <summary> /// Initializes a new instance of the <see cref="CountQuery"/> class. /// </summary> /// <param name="targetType">The target type.</param> /// <param name="filter">The filter.</param> /// <param name="parameters">The parameters.</param> public CountQuery(Type targetType, string filter, params object[] parameters) : base(targetType, " WHERE " + filter, parameters) { ActiveRecordBase.EnsureInitialized(targetType); var model = ActiveRecordModel.GetModel(targetType); string typeName = model.UseAutoImport ? targetType.Name : targetType.FullName; Query = "SELECT COUNT(*) FROM " + typeName + Query; }