Odata service structure – Part II

Odata service structure

Entity

An entity is a potentially empty resource that has either zero content elements or one content elements. The content element contains one to many properties. At least one key field is required. Entities can be addressed individually via key values or as collections via query
options.

Entity type

An entity type describes a collection and has a name. In many cases, the names of the collection and the entity type are equal or related by some convention. Entity types have a structure defined by their properties
and are also associated with a key, which is formed from a subset of the properties of the entity type. The entity key is needed to define associations between the entity types.

Entity set

An entity set represents a potentially empty resource of entries. The cardinality is 0:many. Several entity sets can be based on the same entity type. For example, there might be a service that has the entity
sets EmployeeSet, ContactSet, and ManagerSet, which can all be based on the same entity type called Person. If an entity set is addressed by means of key values, the GET_ENTITY method of the entity set has to be implemented.

Property

A property is a typed element that represents a primitive typed data element, structured data, or a link to another resource. Properties correspond to columns of a table.

Navigation property

Entity types can include one or more navigation properties. A navigation property is a specific type of property containing a link that presents an association instance. These correspond to links that point to
other tables and table entries, depending on the cardinality of the underlying association. The navigation property got its name from the fact that it allows navigation from 1 entity (the entity type
that declares the navigation property) to others (anything from 0).  Similar to properties, navigation properties are specified in a separate element called NavigationProperty; this defines the navigation property
name, the association being used, and the direction.

Association

An association defines a relation between entity types. Recursive relations are allowed. Each association includes 2 association ends, which specify the entity types that are related and the cardinality rules
for each end of the association.

Service document

Service documents comprises of all list of resources URI’s that can be accessible.
Let us have a look at what information does the service document holds. Service document is accessible through the URI.

Service metadata document

Service metadata document contains meta data of all elements in the service. You can see the full metadata of a service by simple adding “$metadata” to the service URI.

Advertisement

Leave a Comment