Skip to main content

datamodel-class

Represents a data model

public class Korzh.EasyQuery.DataModel
: MetaData

Assembly: Korzh.EasyQuery.dll

Constructors

NameTypeDescription
DataModel()voidInitializes a new instance of the Korzh.EasyQuery.DataModel class.

Fields

NameTypeDescription
AggrFunctionsAggrFunctionListList of aggregate functions.
DMEOptionsDictionary<string, string>A dictionary that contains different Data Model Editor options associated with this model
MacrosMacroListList of macro values
XmlSerializerDataModelXmlSerializer

Properties

NameTypeDescription
DefaultPreciseDateEditorValueEditorGets the default "precise date" editor.
DefaultPreciseTimeEditorValueEditorGets the default "precise time" editor.
DefaultSpecialDatesEditorValueEditorGets the default editor that returns the list of the special dates (Today, Yesterday, First day of month, etc).
DefaultSpecialTimesEditorValueEditorGets the default editor that returns the list of the special times (Midnight, Noon, etc).
DefaultTextEditorValueEditorGets the default text editor.
DefQueryFilePathstringGets or sets the file path for default (blank) query used with this data model.
EntityGraphEntityGraphRepresents the graph of entities we operate with in this model This property is mostly used in LINQ query bulder
EntityRootEntity
FormatVersionXmlintGets the version of data model XML format.
IDstringGets or sets the ID of the model
NullOperatorOperatorGets the null operator.
OperatorsOperatorStoreList of data model operators.
TextsTextStorageGets an instance of TextStorage object which holds all text resources used in this assembly
UseResourcesForOperatorsboolGets or sets a value indicating whether we get the main parameters (caption and format) for default operators from resources.

Events

NameTypeDescription
AggrFuncListChangedAggrFuncListChangedEventHandlerOccurs when the list of available aggregate functions was changed.
MacroRequestMacroRequestEventHandlerThis event is raised when a value for some macro is requested.

Methods

NameTypeDescription
AddDefaultEditors()voidAdds the default value editors.
AddDefaultOperators()voidAdds the default operators into model
AddEntityAttr(EntityAttrDescriptor desc)EntityAttrAdds a new attribute to the model.
AddOperatorToAllRelevantAttributes(Operator operatr)voidAdds the operator to all suitable (by data type) attributes.
AddOperatorToEntity(Operator op, Entity ent)voidAdds the operator to all suitable attributes in specified entity.
AddOperatorToSuitedAttributes(Operator operatr)void
AddUpdateOperator(string id, string caption, string expr, string format, DataKind kind = 0, OperatorGroup group = null)OperatorAdds or update an operator.
Clear()voidClears this instance.
Clone()DataModelClones the model object
CreateEntity(Entity parentEntity = null)EntityCreates the entity.
CreateEntityAttr(EntityAttrDescriptor desc)EntityAttrCreates the entity attribute. Used for creating entity attributes while building the model
CreateEntityAttrCore(MetaEntity parent, EntityAttrKind kind)MetaEntityAttr
CreateEntityCore(MetaEntity parent)MetaEntity
CreateNullOperator()OperatorCreates the null operator. U
CreateOperator()OperatorCreates the operator. Used for creating objects while building the model
CreateOperator(string id, string caption, string expr, string format)OperatorCreates the operator. Used for creating objects while building the model
CreateQuery(Query parentQuery = null)QueryCreates a Query object associated with this model
CreateRootEntity()EntityCreates the root entity. This method can be overriden in descendant classes to retrun the object of appropriate class (e.g. DbEntity).
CreateRootEntityCore()MetaEntity
DeleteOperatorFromEntity(Entity ent, Operator op)voidDeletes the operator from any attribute of specified entity (and all its sub-entities).
EnsureEditorExistance(ValueEditor editor)voidEnsures the existance of value editor.
FindEntity(string entityName)EntityFinds an entity by its name.
FindEntityAttr(string attrDef)EntityAttrFinds the entity attribute.
GetAttributeById(string attrID, bool useNullAttr)EntityAttr
GetDefaultOperatorsForDataType(DataType dataType)OperatorListReturns the list of default operators for some data type
GetMacroValue(string macroId)IMacroValueGets the value of the macro by its ID.
ListDefaultOperatorsForDataType(OperatorList operats, DataType dataType)voidFills the list with default operators for some data type
LoadFromXmlFile(string filePath)voidLoads data model from XML file.
LoadFromXmlFile(string filePath, BitOptions options)voidLoads data model from XML file.
LoadFromXmlReader(XmlReader reader)voidLoads data model from XML reader.
LoadFromXmlReader(XmlReader reader, BitOptions options)voidLoads data model from XML reader.
LoadFromXmlStream(Stream stream)voidLoads data model from XML stream.
LoadFromXmlStream(Stream stream, BitOptions options)voidLoads data model from XML stream.
LoadFromXmlString(string xml)voidLoads data model from XML string.
LoadFromXmlString(string xml, BitOptions options)voidLoads data model from XML string.
MergeEntities(Entity destination, Entity[] sources)voidMerges source entities in destination entity and removes them
OnAggrFuncListChanged()voidRaises the AggrFuncListChanged event.
OnDocketRequest(MacroRequestEventArgs e)boolRaises the MacroRequest event.
OnModelLoaded()void
ReadOneModelPropFromJsonAsync(JsonReader reader, string propName, CancellationToken ct)TaskReads one model property from JSON (asynchronous way).
RefillAggrFunctionList()voidRefills the list of aggregate functions.
RefreshResources()voidRe-loads the string values from Korzh.EasyQuery.DataModel.Texts list.
SaveToXmlFile(string filePath)voidSaves data model XML to file.
SaveToXmlFile(string path, BitOptions options)voidSaves data model XML to file.
SaveToXmlStream(Stream stream)voidSaves data model XML to stream.
SaveToXmlStream(Stream stream, BitOptions options)voidSaves data model XML to stream.
SaveToXmlString()stringSaves data model XML specification to string object.
SaveToXmlString(BitOptions options)stringSaves data model XML specification to string object.
SaveToXmlWriter(XmlWriter writer)voidSaves data model specification using XmlWriter.
SaveToXmlWriter(XmlWriter writer, BitOptions options)voidSaves data model specification using XmlWriter.
UpdateOperatorsTexts()voidLoads the text for all default operators from resources.
UpdateOperatorTexts(Operator op)voidLoads the texts for one operator from resources (Texts storage actually)
Validate()voidValidates this model and throws an exception if something is wrong.
ValidateEntityAttrDesc(MetaEntityAttrDescriptor desc)void
WriteContentToJsonAsync(JsonWriter writer, BitOptions options, CancellationToken ct)TaskWrites the main content of the model to JSON (asynchronous way).
WriteModelPropsToJsonAsync(JsonWriter writer, BitOptions options, CancellationToken ct)Task

Static Fields

NameTypeDescription
AnyOperatorGroupOperatorGroupGets the special group which contain any operator
BoolOperatorGroupOperatorGroupGets the group which contains the date/time operators (before, after, between, etc.)
CommonOperatorGroupOperatorGroupGets the group which contains the common operators (equal, not equal, less than, more than, etc)
LastXmlFormatVersionintRead-only constant that represent the latest format version for data model definition XML files
OperatorGroupsOperatorGroupListGets the list of all predefined operator groups
OtherOperatorGroupOperatorGroupGets the group which contains other operators not included in any of the previous group
StringOperatorGroupOperatorGroupGets the group which contains the string operators (starts with, contains)
TimeOperatorGroupOperatorGroupGets the group which contains the date/time operators (before, after, between, etc.)