DbModel class

Database-related implementation of Korzh.EasyQuery.DataModel class. In addition to the basic data it contains also list of database tables and the links between them.

public class Korzh.EasyQuery.Db.DbModel
    : DataModel

Package: Korzh.EasyQuery.Db (targets: netstandard2.0)

Assembly: Korzh.EasyQuery.Db.dll

Constructors

Name Type Description
DbModel() void Initializes a new instance of the Korzh.EasyQuery.Db.DbModel class.

Properties

Name Type Description
DbParams DbParameters Gets the Korzh.EasyQuery.Db.DbParameters object that represents different options of database linked with current data model.
IsEmpty bool Gets a value indicating wether model is empty;
Links TableLinkStore List of links between the model tables.
PrimaryTableName string The name of the primary which will be used as a "root" table for this query (regardless it's used already in any column/condition or not)
StoreDbParams bool Gets or sets a value indicating whether Korzh.EasyQuery.Db.DbModel.DbParams will be store in data model definition file.
TableCategories TableCategoryList Gets the list of table categories.
Tables TableStore Gets list of data model tables.

Methods

Name Type Description
AddEntityAttr(DbEntityAttrDescriptor desc) DbEntityAttr Adds a new attribute to the model.
AssignEntityAttrID(MetaEntityAttr attr) void Assigns the default ID for entity attribute.
Clear() void Clears this instance.
CreateEntityAttr(DbEntityAttrDescriptor desc) DbEntityAttr Creates the entity attribute. Used for creating entity attributes while building the model
CreateEntityAttrCore(MetaEntity entity, EntityAttrKind kind) MetaEntityAttr
CreateNullOperator() Operator Creates the 'null' operator - a special operator which is used when a real operator can't be found (e.g. wrong ID)
CreateOperator() Operator Creates the operator. Used for creating objects while building the model
CreateOperator(string id, string caption, string expr, string format) Operator Creates the operator. Used for creating objects while building the model
CreateQuery(Query parentQuery = null) Query Creates a Query object associated with this model
CreateTableAlias(DbTable fromTable, string aliasName, bool createEntity = True, string entityName = null, Func<TableLink, bool> linkFilter = null, Func<DbEntityAttr, bool> entityAttrFilter = null) DbTable Creates table alias from the table.
OnModelChanged() void Called after the model has been changed.
OnModelLoaded() void Called after the model has been loaded from some file or string.
ReadOneModelPropFromJsonAsync(JsonReader reader, string propName) Task Reads one model property from JSON (asynchronous way).
SetTableCategory(Table table, string categoryName) bool Sets the category of the table. Creates a new category if the specified one does not exist yet.
UpdateTableCategories() void Updates the categories in tables (usually after the loading).
WriteContentToJsonAsync(JsonWriter writer, BitOptions rwOptions) Task Writes the content of DbMomdel to JSON (asynchronous way).