Skip to content

Query class

Represents internal query structure.

public class Korzh.EasyQuery.Query
TypeNameDescription
ColumnStorecolumnsList of all query columns
StringfilePathQuery file location if query is loaded from file
ColumnStorejustSortedColumnsList of just sorted coumns
StringqueryDescriptionUser-defined query description
StringqueryNameUser-defined name of the query
PredicaterootRoot predicate of the query
StringserializationQueryXmlSerialized query
SortedColumnListsortedColumnsList of sorted columns
TypeNameDescription
ColumnStoreColumnsGets the columns.
StringExtraColumnsGets or sets the extra columns.
PredicateExtraConditionsGets the list of extra conditions for this query. These conditions are not visible to end-users but included into result SQL statement as all others (defined in Korzh.EasyQuery.Query.Root predicate).
StringFilePathGets the query file path. It is automatically assigned when you use LoadFromFile method.
StringIDGets or sets the ID of this query.
BooleanIsEmptyGets a value indicating whether this query is empty (no columns and no conditions are defined).
ColumnStoreJustSortedColumnsGets the list of “just sorted” columns (the columns which will occur only in ORDER BY clause)
DataModelModelGets or sets the data model used in this query.
QueryParentGets the parent query.
StringQueryDescriptionGets or sets the query description.
StringQueryNameGets or sets the name of the query.
PredicateRootGets the root predicate of the query.
SortedColumnListSortedColumnsGets the list of sorted columns.
BooleanStoreModelPathGets or sets a value indicating whether this Query object should store the path to corresponding data model and restore it during query loading.
BooleanStoreOptionsGets or sets a value indicating whether this Query object should store the options and restore them during query loading.
BooleanSyncColSortOrderGets or sets a value indicating whether the order of columns must be synchronized with their sorting order.
TextStorageTextsGets an instance of TextStorage object which holds all text resources used in this assembly
Int32TimezoneOffsetTimezone offset (in minutes) for all dates used in the query
TypeNameDescription
ColumnsChangedEventHandlerColumnsChangedThis event is raised when the list of query result columns or a particular column was changed. For example some column was added or some was deleted.
ColumnsChangingEventHandlerColumnsChangingThis event is raised before the list of query columns or a particular column is going to be changed. For example some column will be added or deleted.
ConditionsChangedEventHandlerConditionsChangedThis event is raised when list of query conditions or a particular condition was changed. For example some condition was added or some - was deleted.
EventHandlerModelChangedOccurs after the model has been changed.
SortOrderChangedEventHandlerSortOrderChangedOccurs when the list of sorted columns was changed.
ConditionsChangedEventHandlerSubQueryConditionsChangedThis event is raised when list of subquery conditions or a particular condition was changed. For example some condition was added or some - was deleted.
TypeNameDescription
PredicateAddPredicate(Predicate group, Int32 index = -1)Creates new predicate (condition group) and adds it into the query.
ColumnAddSimpleColumn(String attrId, String caption = null, SortDirection sorting = None)Creates new column by attribute’s id or expression and adds it into query.
SimpleConditionAddSimpleCondition(Predicate predicate, Int32 index, EntityAttr attribute)Creates new simple condition and adds it into the query.
SimpleConditionAddSimpleCondition(String attrId, String operatorId, String[] values)Creates new simple condition and adds it into the query.
SimpleConditionAddSimpleCondition(Predicate predicate, String attrId, String operatorId, String[] values)Creates new simple condition and adds it into the query.
voidCheckDataModel()Checks the data model object. Generates an exception if Model property has null value.
voidCheckModelObject(DataModel model)Checks if model object has appropriate type and raise exception if not
voidClear()Clears the query conditions and result columns.
voidCoreClear()Clears all query content. Can be overriden in derived classes.
AggrFuncExprCreateAggrFuncExpr(DataModel model, String funcID, EqExpression argExpr)Creates the aggregate function expression.
ColumnCreateColumn()Creates a column.
ColumnCreateColumn(EntityAttr attr)Creates a column.
ColumnCreateColumn(String attrId, String caption = null, SortDirection sorting = None)Creates a column.
EntityAttrExprCreateEntityAttrExpr(DataModel model, EntityAttr attr)Creates the entity attribute expression.
EntityAttrExprCreateEntityAttrExpr(DataModel model, String attrId)Creates the entity attribute expression.
QueryFormatsCreateFormats()Creates an instance of QueryFormats (or its descendant).
EntityAttrExprCreateParentEntityAttrExpr(DataModel model, EntityAttr attr)Creates the parent entity attribute expression.
PredicateCreatePredicate()Creates the predicate.
PredicateCreateRootPredicate()Creates the root predicate.
PredicateCreateSilentPredicate()Creates a new “silent” predicate. Here “silent” means neither this predicate nor its conditions will raise ConditionsChanged event in associated query
SimpleConditionCreateSimpleCondition()Creates the simple condition.
SimpleConditionCreateSimpleCondition(String attrId, String operatorId, String[] values)Creates the simple condition.
SimpleConditionCreateSimpleCondition(EntityAttr attr, Operator op, EqExpression[] exprs)Creates the simple condition.
QueryCreateSubQuery()Creates the subquery.
StringGetConditionsText(QueryTextFormats formats)Returns human-readable text that represents current query conditions
QueryFormatsGetFormats()Gets query formats (an instance of Korzh.EasyQuery.QueryFormats class).
StringGetOneValueForAttr(EntityAttr attr)Gets the one value set in some query condition for indicated entity attribute
EntityGetParentQueryRootEntity()Gets the entities from parent query.
voidInnerSortOrderChanged(SortOrderChangedEventArgs e)
voidLoadFromFile(String path)Loads query from file.
voidLoadFromFile(String path, RWOptions rwOptions)Loads query from file.
voidLoadFromJsonDict(JsonDict dict)Loads query from some System.Collections.IDictionary object. Useful for JSON serialization
voidLoadFromJsonDict(JsonDict dict, RWOptions rwOptions)Loads query from some System.Collections.IDictionary object. Useful for JSON serialization
voidLoadFromStream(Stream stream)Loads query from stream.
voidLoadFromStream(Stream stream, RWOptions rwOptions)Loads query from stream.
voidLoadFromString(String xml, RWOptions rwOptions)Loads query from string.
voidLoadFromString(String xml)Loads query from string.
voidLoadFromXmlReader(XmlReader reader)Loads query from XML reader.
voidLoadFromXmlReader(XmlReader reader, RWOptions rwOptions)Loads query from XML reader.
voidLoadNode(XmlReader reader, RWOptions rwOptions)Loads the root node.
DataModelNewModel()Creates new model object of appropriate type.
voidOnColumnsChanged(ColumnsChangeEventArgs e)Raises the ColumnsChanged event.
voidOnColumnsChanging(ColumnsChangingEventArgs e)Raises the ColumnsChanging event.
voidOnConditionsChanged(ConditionsChangeEventArgs e)Raises the ConditionsChanged event.
voidOnSortOrderChanged(SortOrderChangedEventArgs e)Raises the SortOrderChanged event.
voidOnSubQueryConditionsChanged(ConditionsChangeEventArgs e)Raises the SubQueryConditionsChanged event.
voidResyncSortingList(Boolean changeInnerIndex)Resynchronizes the sorting list of columns correspondingly to their order.
voidSaveNodes(XmlWriter writer, RWOptions rwOptions)Saves the root nodes.
voidSaveToFile(String path)Saves query to XML file.
voidSaveToFile(String path, RWOptions Options)Saves query to XML file.
JsonDictSaveToJsonDict()Saves query into some System.Collections.IDictionary object. Useful for JSON serialization
voidSaveToStream(Stream stream)Saves query XML to stream.
voidSaveToStream(Stream stream, RWOptions options)Saves query XML to stream.
StringSaveToString()Saves query to string containing the XML.
StringSaveToString(RWOptions Options)Saves query to string containing the XML.
voidSaveToXmlWriter(XmlWriter writer, RWOptions rwOptions)Saves query to XML using XML writer.
voidValidate()Validates this query instance. This method throws an exception if query has “ghost” attributes