EntityCollections
Entity collection manages a set of entities (see entity types). The set can be persisted in relational database, like SQLite or MySQL databases. Here, a relational table is created foreach entity collection.
The entity collection contains:
Attribute | Description | Data Type |
---|---|---|
Id | Entity collection id | System.Guid |
Name | Name of the collection. If no extra table name is specified, the table in the DB receives this name. | System.String |
EntityTypeName | The entity type name specifies the C# type name of the entity class. | System.String |
Properties:TableName | [OPT] name of the table in the storage | System.String |
Example showing an entity collection based on a C# class called TMyEntity
.
{
"Id": "291BCBF4-3898-4BBF-9461-DB884A77EA30",
"Name": "MyEntityCollection",
"EntityTypeName": "HumanOS.PeMiL.MyImpl.TMyEntity, HumanOS.PeMiL.MyImpl"
}
Fields
A field specifies a property of the entity. Fields are automatically factored from the
Following attributes define an entity field:
Attribute | Description | Data Type |
---|---|---|
Name | Name of the Field | System.String |
DataType | Data type of the field | System.String |
IsKey | Flag, if the field is a primary key | System.Boolean |
NonPersistant | Flag, if the field is not persisted in the storage. | System.Boolean |
Unique | Flag, if the field value is unique | System.Boolean |
Following field types are possible:
- System.String as limited or unlimited text length.
Note for SQLite or MySQL: for string-keys a length must be specified! System.String[]
System.Single
undSystem.Single[]
System.Double
undSystem.Double[]
System.Decimal
undSystem.Decimal[]
System.SByte
undSystem.SByte[]
System.Int16
undSystem.Int16[]
System.Int32
undSystem.Int32[]
System.Int64
undSystem.Int64[]
System.Byte
undSystem.Byte[]
System.UInt16
undSystem.UInt16[]
System.UInt32
undSystem.UInt32[]
System.UInt64
undSystem.UInt64[]
System.Boolean
undSystem.Boolean[]
System.Char
undSystem.Char[]
System.DateTime
undSystem.DateTime[]
System.Guid
undSystem.Guid[]
Readonly View Collections
The readonly view is a special entity collection that joins multiple entity collection as sources to get a view on top. In classical SQL databases this type create a DB View.
Attribute | Description | Data Type |
---|---|---|
Id | Entity collection id | System.Guid |
Name | Name of the collection. If no extra table name is specified, the table in the DB receives this name. | System.String |
EntityTypeName | The entity type name specifies the C# type name of the entity class. | System.String |
Type | Collection type is "ReadOnlyView" | EEntityCollectionType |
MasterCollectionId | Id of the master collection. | System.Guid |
Properties:TableName | [OPT] name of the table in the storage | System.String |
Example:
{
"Id": "291BCBF4-3898-4BBF-9461-DB884A77EA30",
"Name": "MyEntityCollection",
"EntityTypeName": "HumanOS.PeMiL.MyImpl.TMyViewEntity, HumanOS.PeMiL.MyImpl",
"Type": "ReadOnlyView",
"MasterCollectionId" : "C9FFEE4C-2320-49B7-879C-D71605315BE0"
}
The dependencies and joins are defined in the C# class (here TMyViewEntity). Check [HumanOS SDK Manual] for further information.