Show/Hide Toolbars

TMS XData Documentation

Navigation: Entity Model

Entity Model Concepts

Scroll Prev Top Next More

This topic describes the main concepts used in the Entity Model:


Entity Type

The entity type relates to an entity in the same way as a class relates to an object in object-oriented programming. In other words, an entity type is the "class definition" used by XData to retrieve info about an entity it receives or provides. An entity type contain a list of properties, what of those properties are considered the primary key for the entity, etc.. The entity type is related to a Delphi class, and as such it also supports inheritance (an entity type can be inherited from another entity type). By default the name of entity type is the name of the class, with the "T" prefix removed (if any). For example, there might be an entity type named "Customer", related to class TCustomer, with simples properties "Name", "City" and navigation property "Country".


Enum Type

Enum types are named scalar, primitive types that contain a list of name/value pairs which indicates its valid values. For example, the enum type "TSex" might have two name/value pairs: First is name "Male", with value 0, and second is name "Female", with value 1. Simple properties which types are enum types can only receive such values.


Simple Property

A simple property is a property of a scalar type, belonging to an entity type. A simple property can be of any primitive type as integer, boolean, string, etc., or enum types, and can have several facets indicating for example if the property is nullable, or its maximum length. For example, an entity type "TCustomer" can have a simple property "Name" of type string, and a simple property "Sex" of enum type "TSex".


Navigation Property

A navigation property is a property that represents a relationship between two entity types. It might relate to a single entity or a collection of other entities. It's the equivalent of an association in Aurelius mapping, or a foreign key in a database definition. A navigation property has a target property which points to another entity type. For example, an entity type "TOrder" might have a navigation property named "Customer" which target type is the "TCustomer" entity type.


Entity Set

An entity set is a logical container for instances of an entity type (entities) and instances of any type derived from that entity type. It can also be though as a collection of entities of a specified entity type. Thus, each entity set is associated with a entity type. Entity sets could be though as equivalent of a table in a database, but it's not exactly the same, since conceptually you might have different entity sets for the same entity type (although it's not often used). By default the name of the entity set is the name of the entity type associated to it so an entity set "Customer" will provide list of entities of type "Customer". It might be confused that both have same names, but they have different concepts



Services (specified by contracts) are a set of service operations, actions that are executed based on a client request and HTTP method. The service contracts are defined by service interfaces (contracts) and implemented by the server. For more information, see service operations.