MetaData class

public class EasyData.MetaData

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

Assembly: EasyData.Core.dll

Constructors

Name Type Description
MetaData() void Initializes a new instance of the EasyData.MetaData class.

Fields

Name Type Description
DefaultRWOptions BitOptions

Properties

Name Type Description
CustomInfo string Gets or sets the custom information associated with data model.
Description string Gets or sets the description.
Editors ValueEditorList List of data model operators.
EntityRoot MetaEntity The root entity of data model entities.
FilePath string Gets the model file path. It is automatically assigned when you use LoadFromFile method.
FormatVersionJson int Gets or Sets the version of data model JSON format.
Id string Gets or sets the ID of the model.
IsEmpty bool Gets a value indicating whether this model is empty (doesn't contain any entity or attribute) or not.
ModelVersion int Gets the model version.
Name string Gets or sets the user-defined name of the model.

Events

Name Type Description
ModelChanged EventHandler Occurs when the model is changed.

Methods

Name Type Description
AddEntity(MetaEntity entity, string entityName) MetaEntity Adds a sub-entity to the current entity.
AddEntityAttr(MetaEntityAttrDescriptor desc) MetaEntityAttr Adds a new attribute to the model.
AssignEntityAttrID(MetaEntityAttr attr) void Assigns the default ID for entity attribute.
Clear() void Clears this instance.
Clone() MetaData Clones the model object
CreateEntity(MetaEntity parentEntity = null) MetaEntity Creates the entity.
CreateEntityAttr(MetaEntityAttrDescriptor desc) MetaEntityAttr Creates the entity attribute. Used for creating entity attributes while building the model
CreateEntityAttrCore(MetaEntity parent, EntityAttrKind kind) MetaEntityAttr
CreateEntityCore(MetaEntity parent) MetaEntity
CreateRootEntity() MetaEntity Creates 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) MetaEntity Finds an entity by its name.
FindEntityAttr(string attrDef) MetaEntityAttr Find attribute either by its ID, expression or caption.
GetAttributeById(string attrId, bool useNullAttr) MetaEntityAttr Gets the attribute by its ID.
GetNextEntityAttrId() int Gets the next free number for building virtual entity attribute ID.
IncreaseModelVersion() void Increases the model version.
InitModelLoading() void Inits the model loading.
LoadFromJsonFile(string filePath) void Saves the model to a JSON file.
LoadFromJsonFile(string filePath, BitOptions options) void Saves the model to a JSON file.
LoadFromJsonFileAsync(string filePath) Task Loads the metadata from a JSON file as an asynchronous operation.
LoadFromJsonFileAsync(string filePath, BitOptions options) Task Loads the metadata from a JSON file as an asynchronous operation.
LoadFromJsonStream(Stream stream) void Loads data model from JSON stream.
LoadFromJsonStream(Stream stream, BitOptions options) void Loads data model from JSON stream.
LoadFromJsonStreamAsync(Stream stream) Task Loads data model from JSON stream (asynchronous way).
LoadFromJsonStreamAsync(Stream stream, BitOptions options) Task Loads data model from JSON stream (asynchronous way).
LoadFromJsonString(string json) void Loads the model from a string in JSON format.
LoadFromJsonString(string json, BitOptions options) void Loads the model from a string in JSON format.
LoadFromJsonStringAsync(string json) Task Loads the model from a string in JSON format (asynchronous way).
LoadFromJsonStringAsync(string json, BitOptions options) Task Loads the model from a string in JSON format (asynchronous way).
OnModelChanged() void Called after the model has been changed. Raises ModelChanged event if defined.
OnModelLoaded() void Called when the model is loaded (from XML file or string).
ReadFromJson(JsonReader reader, BitOptions options) void Reads the content of the model from the specified JsonReader.
ReadFromJsonAsync(JsonReader reader, BitOptions options) Task Reads the content of the model from the specified JsonReader (asynchronous way).
ReadOneModelPropFromJsonAsync(JsonReader reader, string propName) Task Reads one model property from JSON (asynchronous way).
SaveToJsonFile(string filePath) void Saves the data model to a file in JSON format.
SaveToJsonFile(string filePath, BitOptions options) void Saves the data model to a file in JSON format.
SaveToJsonFileAsync(string filePath) Task Saves the data model to a file in JSON format (asynchronous way).
SaveToJsonFileAsync(string filePath, BitOptions options) Task Saves the data model to a file in JSON format (asynchronous way).
SaveToJsonStream(Stream stream) void Saves the data model to a stream in JSON format.
SaveToJsonStream(Stream stream, BitOptions options) void Saves the data model to a stream in JSON format.
SaveToJsonStreamAsync(Stream stream) Task Saves the data model to a stream in JSON format (asynchronous way).
SaveToJsonStreamAsync(Stream stream, BitOptions options) Task Saves the data model to a stream in JSON format (asynchronous way).
SaveToJsonString() string Saves the model to a string in JSON format.
SaveToJsonString(BitOptions options) string Saves 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() void Sorts all entities and their attributes alphabetically.
SortEntityContent(MetaEntity entity) void Sorts the content of one entity alphabetically. This function is called by EasyData.MetaData.SortEntities method
WriteContentToJsonAsync(JsonWriter writer, BitOptions rwOptions) Task Writes the main content of the model to JSON (asynchronous way).
WriteModelPropsToJsonAsync(JsonWriter writer, BitOptions options) Task Writes properties of the model to JSON (asynchronous way).
WriteToJson(JsonWriter writer) void Writes the content of the data model to JSON using JsonWriter.
WriteToJson(JsonWriter writer, BitOptions options) void Writes the content of the data model to JSON using JsonWriter.
WriteToJsonAsync(JsonWriter writer) Task Writes the content of the data model to JSON using JsonWriter (asynchronous way).
WriteToJsonAsync(JsonWriter writer, BitOptions options) Task Writes the content of the data model to JSON using JsonWriter (asynchronous way).

Static Fields

Name Type Description
LastJsonFormatVersion int Read-only constant that represent the latest format version of data model definition JSON files