Skip to content

Condition class

Represents one condition in the query.

public class Korzh.EasyQuery.Condition
TypeNameDescription
Boolean_isRoot
Boolean_isSilentGets a value indicating whether this query is silent - so no event will be raised on change.
TypeNameDescription
EntityAttrBaseAttrGets the base entity attribute for this condition.
EqExpressionBaseExprGets or sets the base expression of the condtion.
ConditionsStoreConditionsGets the conditions.
OperandDefaultOperandGets the default operand.
ConditionExprListExpressionsGets the list of all expressions used in condition. First expression in the list is base expression.
StringFullNumGets the full number of condition.
Int32IdGets or sets the ID.
Int32IndexGets the index in the parent’s list.
BooleanIsEmptyGets a value indicating whether this condition is empty (zero conditions).
BooleanIsEnabledGets or sets a value indicating whether this Korzh.EasyQuery.Condition is enabled.
BooleanIsGroupGets a value indicating whether this instance is a group of conditions
BooleanIsHavingGets a value indicating whether this condition must be placed into HAVING clause in result SQL.
BooleanIsInJoinGets a value indicating whether this condition must be placed into JOIN clause in result SQL.
BooleanIsParameterizedGets or sets a value indicating whether this Korzh.EasyQuery.Condition is parameterized.
BooleanIsReadOnlyGets or sets a value indicating whether this Korzh.EasyQuery.Condition is read-only.
BooleanIsRootGets a value indicating whether this condition is the root condition of the query.
Int32LevelGets the level of this condition in query.
LinkTypeLinkingGets or sets the linking type.
StringLinkingStrGets or sets the text representation of linking type.
DataModelModelGets the model.
OperatorOperatorGets or sets the operator used in this condition.
ConditionParentGets the parent Korzh.EasyQuery.Condition which this condition is included to.
QueryQueryGets the query which this condition belongs to.
BooleanUseDefaultValuesGets a value indicating whether condition expressions should get default values after creation
TypeNameDescription
ConditionAddConditionGroup(LinkType lnkType = Auto)Creates and adds a new group of conditions into the current one
ConditionAddConditionWithExpr(String attrId, String operatorId, EqExpression[] values)Adds a simple condition by the entity attribute’s ID, the operator’s ID and the list of values
ConditionAddSimpleCondition(String attrId, String operatorId = null, String[] values)Adds a simple condition by attribute ID, operator ID and a list of values
ConditionAddSimpleCondition(EntityAttr attr, Operator op, EqExpression[] exprs)Adds a simple condition by attribute ID, operator ID and a list of values
voidAdjustOperator()Adjusts the operator by base expression.
voidAttachExpr(EqExpression expr)Attaches the handler for expression’s OnContentChange event to DoExprContentChanged method
voidBeginUpdate()Starts the update process. OnConditionsChanged event of corresponding Query object is not raised while condition is in update state
voidChanged(Condition cond = null, ChangeType changeType = Update, Int32 info = 0)Raises ConditionsChange event in parent object
voidCheckDataModel()Checks DataModel property. Generates an exception if it is null.
voidCheckQuery()Checks Query property. Generates an exception if it is null.
BooleanContainsGhosts(Condition& outCond)Determines whether this condition group contains a condition with a “ghost” attribute.
EqExpressionCreateValueExpr(Int32 index)Creates the value expression.
EqExpressionCreateValueExprByOperand(Operand opnd)Creates a value expression by operand.
voidDetachExpr(EqExpression expr)Detaches the handler for expression’s OnContentChange event
voidDoExprContentChanged(Object sender, EventArgs e)Does the expr changed.
voidEndUpdate()Ends the update process. Raises ConditionsChange event if some modification(s) was(were) made during update process.
ConditionFindCondByAttr(EntityAttr attr)Finds the condition the by entity attribute set in the left part of this condition.
EntityAttrGetBaseAttr()Gets the base entity attribute for this condition.
StringGetConditionGroupHeader()Gets the condition group header text.
StringGetConditionText(QueryTextFormats formats, String levelSpace, String prefix)Returns text representation of the search condition
BooleanGetHaving()Gets a value indicating whether this condition must be placed into HAVING clause in result SQL. Must be overriden in the inherited classes
Int32GetOffspringCount()Gets the number of all offspings of the condition group
StringGetOldClassName()Gets the old name of the condition class (PDCT or SMPL).
OperandGetOperand(Int32 index)Gets the condition operand based on its index. Index 0 stands for an attribute
StringGetSimpleConditionText(QueryTextFormats formats, String levelSpace, String prefix)Returns text representation of thesimple condition
StringGetText(QueryTextFormats formats)Returns text representation of condition
StringGetText()Returns text representation of condition
StringGetText(QueryTextFormats formats, String levelSpace, String prefix)Returns text representation of condition
IEnumerable<Entity>GetUsedEntities()Gets the list of entities that are used in conditions of this group.
voidLoadFromXmlReader(XmlReader reader)Loads the propertis of the Korzh.EasyQuery.Condition from the XML reader.
voidLoadXmlAttributes(XmlReader reader)Loads conditions node attributes from XML reader.
voidMoveDown()Moves the condition to one position down (taking into account the level of other conditions).
voidMoveUp()Moves the condition to one position up (taking into account the level of other conditions).
voidReadFromJson(JsonReader reader)Reads the content of the condition from JSON
TaskReadFromJsonAsync(JsonReader reader)Reads the content of the condition from JSON (asynchronous way).
voidReadOnePropFromJson(JsonReader reader, String propName)Reads one property of the condition from JSON
TaskReadOnePropFromJsonAsync(JsonReader reader, String propName)Reads one property of the condition from JSON (asynchronous way).
EqExpressionRecreateValueExpr(Int32 index)Recreates the value expression.
voidRefresh()Refreshes this instance.
voidReset()Clears the condition list and resets linking type
voidSaveToXmlWriter(XmlWriter writer)Saves condition object to XML writer.
voidScan(Action<Condition> conditionHandler, Boolean processRoot = True)Scans all sub-conditions of this condition group and calls a handler for each of them
voidSetEnabled(Boolean newValue, Boolean silent = False)Sets the Enabled property.
voidSetOperator(Operator newOperator)Sets the operator.
voidSetOperatorSilent(Operator newOperator)Sets the operator in “silent” mode (no event is raised, no expression is adjusted).
voidSetQuery(Query newQuery)Sets the query.
voidSetReadOnly(Boolean newValue, Boolean silent = False)Sets the ReadOnly property.
voidSetValueExpr(Int32 index, EqExpression expr)Sets the value expression.
voidShiftLevel(Boolean up)Shifts the row level (taking into account the level of other rows)
voidUpdateEnableStateByChilds()This procedure is called when Enable state in one of the child conditions was changed.
voidWriteContentToXml(XmlWriter writer)Writes the content of condition to the XmlWriter object.
voidWritePropertiesToJson(JsonWriter writer)Writes all condition properties to JSON (this method can be overriden in inherited classes)
TaskWritePropertiesToJsonAsync(JsonWriter writer)Writes all condition properties to JSON (asynchronous way). (this method can be overriden in inherited classes)
voidWriteToJson(JsonWriter writer)Writes the content of the condition to JSON
TaskWriteToJsonAsync(JsonWriter writer)Writes the content of the condition to JSON (asynchronous way).
TypeNameDescription
StringGroupTagThe tag (condition class) which represents a group of conditions
StringSimpleConditionTagThe tag (condition class) which represents a simple condition
StringXmlTagNameThe name of the tag which used when we serialize condition to XML
TypeNameDescription
StringLinkTypeToStr(LinkType lt)Converts LinkType value to its string representation
LinkTypeStrToLinkType(String s)Convert string representation to LinkType value.