Skip to main content

condition-class

Represents one condition in the query.

public class Korzh.EasyQuery.Condition

Assembly: Korzh.EasyQuery.dll

Properties

NameTypeDescription
BaseAttrEntityAttrGets the base entity attribute for this condition.
BaseExprEqExpressionGets or sets the base expression of the condtion.
ConditionsConditionsStoreGets the conditions.
DefaultOperandOperandGets the default operand.
ExpressionsConditionExprListGets the list of all expressions used in condition. First expression in the list is base expression.
FullNumstringGets the full number of condition.
HasEnabledboolGets a value indicating whether this group has at least one enabled condition.
IdintGets or sets the ID.
IndexintGets the index in the parent's list.
IsEmptyboolGets a value indicating whether this condition is empty (zero conditions).
IsEnabledboolGets or sets a value indicating whether this Korzh.EasyQuery.Condition is enabled.
IsGroupboolGets a value indicating whether this instance is a group of conditions
IsHavingboolGets a value indicating whether this condition must be placed into HAVING clause in result SQL.
IsInJoinboolGets a value indicating whether this condition must be placed into JOIN clause in result SQL.
IsParameterizedboolGets or sets a value indicating whether this Korzh.EasyQuery.Condition is parameterized.
IsReadOnlyboolGets or sets a value indicating whether this Korzh.EasyQuery.Condition is read-only.
IsRootboolGets a value indicating whether this condition is the root condition of the query.
IsUpdatingboolGets a value indicating whether this instance is updating.
LevelintGets the level of this condition in query.
LinkingCondition.LinkTypeGets or sets the linking type.
LinkingStrstringGets or sets the text representation of linking type.
ModelDataModelGets the model.
OperatorOperatorGets or sets the operator used in this condition.
ParentConditionGets the parent Korzh.EasyQuery.Condition which this condition is included to.
QueryQueryGets the query which this condition belongs to.
UseDefaultValuesboolGets a value indicating whether condition expressions should get default values after creation

Methods

NameTypeDescription
AddConditionGroup(LinkType lnkType = 99)ConditionCreates and adds a new group of conditions into the current one
AddConditionWithExpr(string attrId, string operatorId, EqExpression[] values)ConditionAdds a simple condition by the entity attribute's ID, the operator's ID and the list of values
AddCustomCondition(string operatorId, EqExpression[] expressions)Condition
AddSimpleCondition(string attrId, string operatorId = null, String[] values)ConditionAdds a simple condition by attribute ID, operator ID and a list of values
AddSimpleCondition(EntityAttr attr, Operator op, EqExpression[] exprs)ConditionAdds a simple condition by attribute ID, operator ID and a list of values
AdjustOperator()voidAdjusts the operator by base expression.
BeginUpdate()voidStarts the update process. OnConditionsChanged event of corresponding Query object is not raised while condition is in update state
CheckDataModel()voidChecks DataModel property. Generates an exception if it is null.
CheckQuery()voidChecks Query property. Generates an exception if it is null.
Clone()ConditionCreates a duplicate of the current condition.
ContainsGhosts(Condition& outCond)boolDetermines whether this condition group contains a condition with a "ghost" attribute.
CreateValueExpr(int index)EqExpressionCreates the value expression.
CreateValueExprByOperand(Operand opnd)EqExpressionCreates a value expression by operand.
DoExprContentChanged(object sender, EventArgs e)voidDoes the expr changed.
EndUpdate()voidEnds the update process. Raises ConditionsChange event if some modification(s) was(were) made during update process.
Find(Func<Condition, bool> conditionPredicate, bool processGroup = True)ConditionSearch all sub-conditions of this condition and returns the first condition for which conditionPredicate function returns true
FindCondByAttr(EntityAttr attr)ConditionFinds the condition the by entity attribute set in the left part of this condition.
GetBaseAttr()EntityAttrGets the base entity attribute for this condition.
GetConditionGroupHeader()stringGets the condition group header text.
GetConditionText(QueryTextFormats formats, string levelSpace, string prefix)stringReturns text representation of the search condition
GetHaving()boolGets a value indicating whether this condition must be placed into HAVING clause in result SQL. Must be overriden in the inherited classes
GetOffspringCount()intGets the number of all offspings of the condition group
GetOldClassName()stringGets the old name of the condition class (PDCT or SMPL).
GetOperand(int index)OperandGets the condition operand based on its index. Index 0 stands for an attribute
GetSimpleConditionText(QueryTextFormats formats, string levelSpace, string prefix)stringReturns text representation of thesimple condition
GetText(QueryTextFormats formats)stringReturns text representation of condition
GetText()stringReturns text representation of condition
GetText(QueryTextFormats formats, string levelSpace, string prefix)stringReturns text representation of condition
GetUsedEntities()IEnumerable<Entity>Gets the list of entities that are used in conditions of this group.
InsertSimpleCondition(int index, EntityAttr attr, Operator op, EqExpression[] exprs)ConditionInserts a simple condition by the attribute, the operator and the list of expressions
IsGhostBaseExpr()bool
LoadFromXmlReader(XmlReader reader)voidLoads the propertis of the Korzh.EasyQuery.Condition from the XML reader.
LoadXmlAttributes(XmlReader reader)voidLoads conditions node attributes from XML reader.
MoveDown()voidMoves the condition to one position down (taking into account the level of other conditions).
MoveUp()voidMoves the condition to one position up (taking into account the level of other conditions).
ReadFromJsonAsync(JsonReader reader, CancellationToken ct = null)TaskReads the content of the condition from JSON (asynchronous way).
ReadOnePropFromJsonAsync(JsonReader reader, string propName, CancellationToken ct)TaskReads one property of the condition from JSON (asynchronous way).
RecreateValueExpr(int index)EqExpressionRecreates the value expression.
Refresh()voidRefreshes this instance.
RemoveThis()voidRemoves this condition from the query
Reset()voidClears the condition list and resets linking type
SaveToXmlWriter(XmlWriter writer)voidSaves condition object to XML writer.
Scan(Action<Condition> conditionHandler, bool processGroup = True)voidScans all sub-conditions of this condition group and calls a handler for each of them
SetEnabled(bool newValue, bool updateChildren = True, bool silent = False)voidSets the Enabled property.
SetOperator(Operator newOperator)voidSets the operator.
SetOperatorSilent(Operator newOperator)voidSets the operator in "silent" mode (no event is raised, no expression is adjusted).
SetQuery(Query newQuery)voidSets the query.
SetReadOnly(bool newValue, bool silent = False)voidSets the ReadOnly property.
SetValueExpr(int index, EqExpression expr)voidSets the value expression.
ShiftLevel(bool up)voidShifts the row level (taking into account the level of other rows)
WriteContentToXml(XmlWriter writer)voidWrites the content of condition to the XmlWriter object.
WritePropertiesToJsonAsync(JsonWriter writer, CancellationToken ct)TaskWrites all condition properties to JSON (asynchronous way). (this method can be overriden in inherited classes)
WriteToJsonAsync(JsonWriter writer, CancellationToken ct = null)TaskWrites the content of the condition to JSON (asynchronous way).

Static Fields

NameTypeDescription
GroupTagstringThe tag (condition class) which represents a group of conditions
SimpleConditionTagstringThe tag (condition class) which represents a simple condition
XmlTagNamestringThe name of the tag which used when we serialize condition to XML

Static Methods

NameTypeDescription
LinkTypeToStr(LinkType lt)stringConverts LinkType value to its string representation
StrToLinkType(string s)Condition.LinkTypeConvert string representation to LinkType value.