Skip to content

DataModel class

Represents a data model

public class Korzh.EasyQuery.DataModel
TypeNameDescription
Int32_maxEntAttrIDNumber of virtual attributes
String_modelNameUser-defined name of the model
Int32_modelVersionVersion of the model
AggrFunctionListAggrFunctionsList of aggregate functions.
StringcustomInfoUser-defined additional information about the model
StringdefQueryFilePathFile path for default query
StringdescriptionDescription of the model
Dictionary<String, String>DMEOptionsA dictionary that contains different Data Model Editor options associated with this model
EntityentityRootMain entity of the model
StringfilePathRepresents model file location, if model is loaded from file
Int32formatVersionXmlFormat version of data model definition XML files
MacroListMacrosList of macro values
BooleanuseResourcesForOperatorsIndicates whether resources will be used for getting caption and format of the Korzh.EasyQuery.Operator
TypeNameDescription
StringCustomInfoGets or sets the custom information associated with data model.
ValueEditorDefaultPreciseDateEditorGets the default “precise date” editor.
ValueEditorDefaultPreciseTimeEditorGets the default “precise time” editor.
ValueEditorDefaultTextEditorGets the default text editor.
StringDefQueryFilePathGets or sets the file path for default (blank) query used with this data model.
StringDescriptionGets or sets the description.
ValueEditorListEditorsList of data model operators.
EntityGraphEntityGraphRepresents the graph of entities we operate with in this model This property is mostly used in LINQ query bulder
EntityEntityRootThe root entity of data model entities.
StringFilePathGets the model file path. It is automatically assigned when you use LoadFromFile method.
Int32FormatVersionJsonGets or Sets the version of data model JSON format.
Int32FormatVersionXmlGets the version of data model XML format.
StringIDGets or sets the ID of the model.
BooleanIsEmptyGets a value indicating whether this model is empty (doesn’t contain any entity or attribute) or not.
Int32ModelVersionGets the model version.
StringNameGets or sets the user-defined name of the model.
OperatorNullOperatorGets the null operator.
OperatorStoreOperatorsList of data model operators.
IProgressIndicatorProgressIndicatorGets or sets the progress indicator object. This property is used to show progress for some time consuming operations performed inside model
TextStorageTextsGets an instance of TextStorage object which holds all text resources used in this assembly
BooleanUseResourcesForOperatorsGets or sets a value indicating whether we get the main parameters (caption and format) for default operators from resources.
TypeNameDescription
AggrFuncListChangedEventHandlerAggrFuncListChangedOccurs when the list of available aggregate functions was changed.
MacroRequestEventHandlerMacroRequestThis event is raised when a value for some macro is requested.
EventHandlerModelChangedOccurs when the model is changed.
TypeNameDescription
voidAddDefaultEditors()Adds the default value editors.
voidAddDefaultOperators()Adds the default operators into model
EntityAddEntity(Entity entity, String entityName)Adds a sub-entity to the current entity.
EntityAttrAddEntityAttr(Entity entity, String expression, String caption = null, DataType dataType = String, Int32 size = 100)Adds a new attribute to the model.
voidAddOperatorToEntity(Operator op, Entity ent)Adds the operator to all suitable attributes in specified entity.
voidAddOperatorToSuitedAttributes(Operator op)Adds the operator to all suitable (by data type) attributes.
OperatorAddUpdateOperator(String id, String caption, String expr, String format, DataKind kind = Scalar, OperatorGroup group = null)Adds or update an operator.
voidAssignEntityAttrID(EntityAttr attr)Assigns the default ID for entity attribute.
voidClear()Clears this instance.
DataModelClone()Clones the model object
EntityCreateEntity(Entity parentEntity = null)Creates the entity.
EntityAttrCreateEntityAttr(Entity parentEntity = null, Boolean isVirtual = False)Creates the entity attribute. Used for creating entity attributes while building the model
EntityAttrCreateGhostAttribute(String id)Generates NULL (ghost) attribute with ID passed in parameter
OperatorCreateNullOperator()Creates the null operator. U
OperatorCreateOperator()Creates the operator. Used for creating objects while building the model
OperatorCreateOperator(String id, String caption, String expr, String format)Creates the operator. Used for creating objects while building the model
QueryCreateQuery(Query parentQuery = null)Creates a Query object associated with this model
EntityCreateRootEntity()Creates the root entity. This method can be overriden in descendant classes to retrun the object of appropriate class (e.g. DbEntity).
voidDeleteOperator(Operator op)Deletes the operator from the model.
voidDeleteOperatorFromEntity(Entity ent, Operator op)Deletes the operator from any attribute of specified entity (and all its sub-entities).
voidEnsureEditorExistance(ValueEditor editor)Ensures the existance of value editor.
EntityFindEntity(String entityName)Finds an entity by its name.
EntityAttrFindEntityAttr(String attrDef)Find attribute either by its ID, expression or caption.
StringFixDefaultValues(String value)
EntityAttrGetAttributeByID(String attrID, Boolean useNullAttr)Gets the attribute by its ID.
OperatorListGetDefaultOperatorsForDataType(DataType dataType)Returns the list of default operators for some data type
EntityAttrGetDefaultUICAttribute()Returns the first attribute in the Root entity with UseInConditions set to true. This attribute is shown by default for new condition.
EntityAttrGetDefaultUIRAttribute()Returns the first attribute in the Root entity with UseInResult set to true. This attribute is shown by default for new column.
EntityAttrGetDefaultUIRAttribute(Boolean needUseInSorting)Returns the first attribute in the Root entity with UseInResult set to true. This attribute is shown by default for new column.
IMacroValueGetMacroValue(String macroId)Gets the value of the macro by its ID.
Int32GetNextEntityAttrID()Gets the next free number for building virtual entity attribute ID.
voidIncreaseModelVersion()Increases the model version.
voidInitModelLoading()Inits the model loading.
voidListDefaultOperatorsForDataType(OperatorList operats, DataType dataType)Fills the list with default operators for some data type
voidLoadFromJsonFile(String path, ModelReadWriteOptions options = All)Saves the model to a JSON file.
TaskLoadFromJsonFileAsync(String path, ModelReadWriteOptions options = All)Saves the model to a JSON file (asynchronous way).
voidLoadFromJsonStream(Stream stream, ModelReadWriteOptions options = All)Loads data model from JSON stream.
TaskLoadFromJsonStreamAsync(Stream stream, ModelReadWriteOptions options = All)Loads data model from JSON stream (asynchronous way).
voidLoadFromJsonString(String json, ModelReadWriteOptions options = All)Loads the model from a string in JSON format.
TaskLoadFromJsonStringAsync(String json, ModelReadWriteOptions options = All)Loads the model from a string in JSON format (asynchronous way).
voidLoadFromXmlFile(String path, ModelReadWriteOptions options = All)Loads data model from XML file.
voidLoadFromXmlReader(XmlReader reader, ModelReadWriteOptions options = All)Loads data model from XML reader.
voidLoadFromXmlStream(Stream stream, ModelReadWriteOptions options = All)Loads data model from XML stream.
voidLoadFromXmlString(String xml, ModelReadWriteOptions options = All)Loads data model from XML string.
voidLoadModelAtrributesFromXmlReader(XmlReader reader)Loads data model’s attributes from the main XML node (DataModel)
voidLoadNode(XmlReader reader, ModelReadWriteOptions rwOptions)Loads the root node of the model. Can be overriden for loading additional root nodes in Korzh.EasyQuery.DataModel’s descendants
voidLoadOneModelAtrributeFromXmlReader(XmlReader reader)Processes one data model’s attribute from the main XML node (DataModel)
StringLoadValueEditorNode(ValueEditor editor, XmlReader reader)Loads the value editor definition from XML.
voidOnAggrFuncListChanged()Raises the AggrFuncListChanged event.
BooleanOnDocketRequest(MacroRequestEventArgs e)Raises the MacroRequest event.
voidOnModelChanged()Called after the model has been changed. Raises ModelChanged event if defined.
voidOnModelLoaded()Called when the model is loaded (from XML file or string).
EqExpressionPostProcessQueryExpr(QueryExpr queryExpr)Post process QueryExpr during the loading (to support the old format of XML query files)
voidReadFromJson(JsonReader reader, ModelReadWriteOptions options)Reads the content of the model from the specified JsonReader.
TaskReadFromJsonAsync(JsonReader reader, ModelReadWriteOptions options)Reads the content of the model from the specified JsonReader (asynchronous way).
voidReadOneModelPropFromJson(JsonReader reader, String propName)Reads one model property from JSON.
TaskReadOneModelPropFromJsonAsync(JsonReader reader, String propName)Reads one model property from JSON (asynchronous way).
voidRefillAggrFunctionList()Refills the list of aggregate functions.
voidRefreshResources()Re-loads the string values from Korzh.EasyQuery.DataModel.Texts list.
voidSaveAttributes(XmlWriter writer, ModelReadWriteOptions options)Saves the attributes of the model. Can be overriden for storing additional attributes
voidSaveCustomInfoNode(XmlWriter writer)Saves the custom info node.
voidSaveNodes(XmlWriter writer, ModelReadWriteOptions options)Saves the root nodes of the model. Can be overriden for storing additional nodes
voidSaveToJsonFile(String filePath, ModelReadWriteOptions options = All)Saves the data model to a file in JSON format.
TaskSaveToJsonFileAsync(String filePath, ModelReadWriteOptions options = All)Saves the data model to a file in JSON format (asynchronous way).
voidSaveToJsonStream(Stream stream, ModelReadWriteOptions options = All)Saves the data model to a stream in JSON format.
TaskSaveToJsonStreamAsync(Stream stream, ModelReadWriteOptions options = All)Saves the data model to a stream in JSON format (asynchronous way).
StringSaveToJsonString(ModelReadWriteOptions options = All)Saves the model to a string in JSON format.
Task<String>SaveToJsonStringAsync(ModelReadWriteOptions options = All)Saves the model to a string in JSON format (asynchronous way).
Task<String>SaveToJsonStringForClientAsync()Saves the model to a string in JSON format, suitable for the client-side
voidSaveToXmlFile(String path, ModelReadWriteOptions options = All)Saves data model XML to file.
voidSaveToXmlStream(Stream stream, ModelReadWriteOptions options = All)Saves data model XML to stream.
StringSaveToXmlString(ModelReadWriteOptions options = All)Saves data model XML specification to string object.
voidSaveToXmlWriter(XmlWriter writer)Saves data model specification using XmlWriter.
voidSaveToXmlWriter(XmlWriter writer, ModelReadWriteOptions options)Saves data model specification using XmlWriter.
voidSetProgress(Int32 pos)Set the progress to the specified position.
voidSetProgressMinMax(Int32 min, Int32 max)Sets the minimum and maximum of progress indicator.
voidSortEntities()Sorts all entities and their attributes alphabetically.
voidSortEntityContent(Entity entity)Sorts the content of one entity alphabetically. This function is called by Korzh.EasyQuery.DataModel.SortEntities method
StringToNewMacrosFormat(String value)
StringToOldMacrosFormat(String value)
voidUpdateOperatorsTexts()Loads the text for all default operators from resources.
voidUpdateOperatorTexts(Operator op)Loads the texts for one operator from resources (Texts storage actually)
voidWriteContentToJson(JsonWriter writer, ModelReadWriteOptions rwOptions)Writes the main content of the model to JSON.
TaskWriteContentToJsonAsync(JsonWriter writer, ModelReadWriteOptions rwOptions)Writes the main content of the model to JSON (asynchronous way).
voidWriteToJson(JsonWriter writer, ModelReadWriteOptions options = All)Writes the content of the data model to JSON using JsonWriter.
TaskWriteToJsonAsync(JsonWriter writer, ModelReadWriteOptions options = All)Writes the content of the data model to JSON using JsonWriter (asynchronous way).
TypeNameDescription
OperatorGroupAnyOperatorGroupGets the special group which contain any operator
OperatorGroupBoolOperatorGroupGets the group which contains the date/time operators (before, after, between, etc.)
OperatorGroupCommonOperatorGroupGets the group which contains the common operators (equal, not equal, less than, more than, etc)
Int32LastJsonFormatVersionRead-only constant that represent the latest format version of data model definition JSON files
Int32LastXmlFormatVersionRead-only constant that represent the latest format version for data model definition XML files
OperatorGroupListOperatorGroupsGets the list of all predefined operator groups
OperatorGroupOtherOperatorGroupGets the group which contains other operators not included in any of the previous group
OperatorGroupStringOperatorGroupGets the group which contains the string operators (starts with, contains)
OperatorGroupTimeOperatorGroupGets the group which contains the date/time operators (before, after, between, etc.)