Skip to content

MetaData class

public class EasyData.MetaData

Package: EasyData.Core (targets: netstandard2.0)

Assembly: EasyData.Core.dll

NameTypeDescription
MetaData()voidInitializes a new instance of the EasyData.MetaData class.
NameTypeDescription
DefaultRWOptionsBitOptions
NameTypeDescription
CustomInfostringGets or sets the custom information associated with data model.
DescriptionstringGets or sets the description.
EditorsValueEditorListList of data model operators.
EntityRootMetaEntityThe root entity of data model entities.
FilePathstringGets the model file path. It is automatically assigned when you use LoadFromFile method.
FormatVersionJsonintGets or Sets the version of data model JSON format.
IdstringGets or sets the ID of the model.
IsEmptyboolGets a value indicating whether this model is empty (doesn’t contain any entity or attribute) or not.
ModelVersionintGets the model version.
NamestringGets or sets the user-defined name of the model.
NameTypeDescription
ModelChangedEventHandlerOccurs when the model is changed.
NameTypeDescription
AddEntity(MetaEntity entity, string entityName)MetaEntityAdds a sub-entity to the current entity.
AddEntityAttr(MetaEntityAttrDescriptor desc)MetaEntityAttrAdds a new attribute to the model.
AssignEntityAttrID(MetaEntityAttr attr)voidAssigns the default ID for entity attribute.
Clear()voidClears this instance.
Clone()MetaDataClones the model object
CreateEntity(MetaEntity parentEntity = null)MetaEntityCreates the entity.
CreateEntityAttr(MetaEntityAttrDescriptor desc)MetaEntityAttrCreates the entity attribute. Used for creating entity attributes while building the model
CreateEntityAttrCore(MetaEntity parent, EntityAttrKind kind)MetaEntityAttr
CreateEntityCore(MetaEntity parent)MetaEntity
CreateRootEntity()MetaEntityCreates the root entity. This method can be overriden in descendant classes to retrun the object of appropriate class (e.g. DbEntity).
CreateRootEntityCore()MetaEntity
FindEntity(string entityName)MetaEntityFinds an entity by its name.
FindEntityAttr(string attrDef)MetaEntityAttrFind attribute either by its ID, expression or caption.
GetAttributeById(string attrId, bool useNullAttr)MetaEntityAttrGets the attribute by its ID.
GetNextEntityAttrId()intGets the next free number for building virtual entity attribute ID.
IncreaseModelVersion()voidIncreases the model version.
InitModelLoading()voidInits the model loading.
LoadFromJsonFile(string filePath)voidSaves the model to a JSON file.
LoadFromJsonFile(string filePath, BitOptions options)voidSaves the model to a JSON file.
LoadFromJsonFileAsync(string filePath)TaskLoads the metadata from a JSON file as an asynchronous operation.
LoadFromJsonFileAsync(string filePath, BitOptions options)TaskLoads the metadata from a JSON file as an asynchronous operation.
LoadFromJsonStream(Stream stream)voidLoads data model from JSON stream.
LoadFromJsonStream(Stream stream, BitOptions options)voidLoads data model from JSON stream.
LoadFromJsonStreamAsync(Stream stream)TaskLoads data model from JSON stream (asynchronous way).
LoadFromJsonStreamAsync(Stream stream, BitOptions options)TaskLoads data model from JSON stream (asynchronous way).
LoadFromJsonString(string json)voidLoads the model from a string in JSON format.
LoadFromJsonString(string json, BitOptions options)voidLoads the model from a string in JSON format.
LoadFromJsonStringAsync(string json)TaskLoads the model from a string in JSON format (asynchronous way).
LoadFromJsonStringAsync(string json, BitOptions options)TaskLoads the model from a string in JSON format (asynchronous way).
OnModelChanged()voidCalled after the model has been changed. Raises ModelChanged event if defined.
OnModelLoaded()voidCalled when the model is loaded (from XML file or string).
ReadFromJson(JsonReader reader, BitOptions options)voidReads the content of the model from the specified JsonReader.
ReadFromJsonAsync(JsonReader reader, BitOptions options)TaskReads the content of the model from the specified JsonReader (asynchronous way).
ReadOneModelPropFromJsonAsync(JsonReader reader, string propName)TaskReads one model property from JSON (asynchronous way).
SaveToJsonFile(string filePath)voidSaves the data model to a file in JSON format.
SaveToJsonFile(string filePath, BitOptions options)voidSaves the data model to a file in JSON format.
SaveToJsonFileAsync(string filePath)TaskSaves the data model to a file in JSON format (asynchronous way).
SaveToJsonFileAsync(string filePath, BitOptions options)TaskSaves the data model to a file in JSON format (asynchronous way).
SaveToJsonStream(Stream stream)voidSaves the data model to a stream in JSON format.
SaveToJsonStream(Stream stream, BitOptions options)voidSaves the data model to a stream in JSON format.
SaveToJsonStreamAsync(Stream stream)TaskSaves the data model to a stream in JSON format (asynchronous way).
SaveToJsonStreamAsync(Stream stream, BitOptions options)TaskSaves the data model to a stream in JSON format (asynchronous way).
SaveToJsonString()stringSaves the model to a string in JSON format.
SaveToJsonString(BitOptions options)stringSaves the model to a string in JSON format.
SaveToJsonStringAsync()Task<string>Saves the model to a string in JSON format (asynchronous way).
SaveToJsonStringAsync(BitOptions options)Task<string>Saves the model to a string in JSON format (asynchronous way).
SortEntities()voidSorts all entities and their attributes alphabetically.
SortEntityContent(MetaEntity entity)voidSorts the content of one entity alphabetically. This function is called by EasyData.MetaData.SortEntities method
WriteContentToJsonAsync(JsonWriter writer, BitOptions rwOptions)TaskWrites the main content of the model to JSON (asynchronous way).
WriteModelPropsToJsonAsync(JsonWriter writer, BitOptions options)TaskWrites properties of the model to JSON (asynchronous way).
WriteToJson(JsonWriter writer)voidWrites the content of the data model to JSON using JsonWriter.
WriteToJson(JsonWriter writer, BitOptions options)voidWrites the content of the data model to JSON using JsonWriter.
WriteToJsonAsync(JsonWriter writer)TaskWrites the content of the data model to JSON using JsonWriter (asynchronous way).
WriteToJsonAsync(JsonWriter writer, BitOptions options)TaskWrites the content of the data model to JSON using JsonWriter (asynchronous way).
NameTypeDescription
LastJsonFormatVersionintRead-only constant that represent the latest format version of data model definition JSON files