Skip to main content

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

Assembly: Korzh.EasyQuery.Db.dll

Constructors

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

Properties

NameTypeDescription
DbParamsDbParametersGets the Korzh.EasyQuery.Db.DbParameters object that represents different options of database linked with current data model.
IsEmptyboolGets a value indicating wether model is empty;
LinksTableLinkStoreList of links between the model tables.
PrimaryTableNamestringThe 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)
StoreDbParamsboolGets or sets a value indicating whether Korzh.EasyQuery.Db.DbModel.DbParams will be store in data model definition file.
TableCategoriesTableCategoryListGets the list of table categories.
TablesTableStoreGets list of data model tables.

Methods

NameTypeDescription
AddEntityAttr(DbEntityAttrDescriptor desc)DbEntityAttrAdds a new attribute to the model.
AssignEntityAttrID(MetaEntityAttr attr)voidAssigns the default ID for entity attribute.
Clear()voidClears this instance.
CreateEntityAttr(DbEntityAttrDescriptor desc)DbEntityAttrCreates the entity attribute. Used for creating entity attributes while building the model
CreateEntityAttrCore(MetaEntity entity, EntityAttrKind kind)MetaEntityAttr
CreateNullOperator()OperatorCreates the 'null' operator - a special operator which is used when a real operator can't be found (e.g. wrong ID)
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
CreateTableAlias(DbTable fromTable, string aliasName, bool createEntity = True, string entityName = null, `Func`<[TableLink](/korzh-easyquery-db-namespace/tablelink-class), `bool`> linkFilter = null, `Func`<[DbEntityAttr](/korzh-easyquery-db-namespace/dbentityattr-class), `bool`> entityAttrFilter = null)DbTableCreates table alias from the table.
OnModelChanged()voidCalled after the model has been changed.
OnModelLoaded()voidCalled after the model has been loaded from some file or string.
ReadOneModelPropFromJsonAsync(JsonReader reader, string propName, CancellationToken ct)TaskReads one model property from JSON (asynchronous way).
SetTableCategory(Table table, string categoryName)boolSets the category of the table. Creates a new category if the specified one does not exist yet.
UpdateTableCategories()voidUpdates the categories in tables (usually after the loading).
ValidateEntityAttrDesc(MetaEntityAttrDescriptor desc)void
WriteContentToJsonAsync(JsonWriter writer, BitOptions rwOptions, CancellationToken ct)TaskWrites the content of DbMomdel to JSON (asynchronous way).