Tcl OData Documentation — OData Entity Set Class
- NAME
- odata::EntitySet — class representing an OData Entity Set
- SYNOPSIS
- CLASS HIERARCHY
- DESCRIPTION
- CONSTRUCTOR
- DESTRUCTOR
- EXPORTED METHODS
- entitySet foreach entityObjVar entityDict script
- entitySet getPage pageNumber
- entitySet index entityIndex
- entitySet info subCommand
- count
- query
- type
- entitySet entities
- entitySet refresh ?command?
- entitySet release
- NON-EXPORTED METHODS
- EXAMPLES
- SEE ALSO
odata::EntitySet — class representing an OData Collection
package require TclOO
set svc [odata::Service http://services.odata.org/TripPinRESTierService]
set entitySet [$svc query People]
$entitySet ...
This class is used by an instance of the OData service class,
odata::Service, to represent the results of queries on entity sets that
are part of the service. It is also used by and the OData entity class,
odata::Entity, to represent the results of queries on relations that are
part of the entity.
The constructor of this class is private and should not be used except by an
instance of the odata::Service class or an instance of the
odata::Entity class.
The destructor of this class is private and should not be used other than by
an instance of the odata::Service class.
release.
- entitySet foreach entityObjVar entityDict script
-
Executes the script once for each entity (aka entity) in the entity set.
The variable entityObjVar shall contain a reference to the instance of
odata::Entity class representing that entity.
The variable entityDict shall contain a dictionary of the properties and
attributes of entity. The contents of the dictionary are discarded at the end of
the loop, thus any changes to the dictionary have no effect on the entity. The
format of the dictionary is:.
- Properties
- The value is a dictionary of property information where the key is the
property name with the following structure:
- Value
- The value of the property.
- Attributes
- The value is a dictionary of attribute information where the key is the property name with the following structure:
- Value
- The value of the property.
- Alias
- The namespace alias of the property.
- Namespace
- The URI of the namespace of the property.
- entitySet getPage pageNumber
-
This method is only available if the -pageSize option was specified. This
method queries for the specific "page" of data and replaces the contents of the
entity set with the results. Page numbers start at zero (0). This is the same as
specifying $skip as the result of resultSetSize (specified to the
-pageSize option) multiplied by pageNumber.
- entitySet index entityIndex
-
A reference to the entityIndex instance of an odata::Entity class
in the entitySet is returned. The indexes start at zero and can assume
any form allowed by the llindex Tcl command.
- entitySet info subCommand ?arg ...?
-
This command is used to query information about the entitySet.
Valid subCommand are:
- count
- Returns the the number of objects in the entitySet.
- query
- Returns a list two elements as follows:
- The restrictionDict dictionary used in the query.
- The list of options used in the query.
- type
- Returns the type of the object that the entitySet consist of.
- entitySet entities
-
Returns a list of instances of odata::Entity class that are in the entity set.
- entitySet refresh ?command?
-
Re-excute the query on the OData server and replaces the current contents of the
entity set with the results.
If command is specified, the query to be performed asynchronously. When
complete, the command will be called with this instance of the
odata::EntitySet class appended to it.
- entitySet release
-
Deletes the entitySet and all of the instances of odata::Entity class that are in the entity set.
While the odata::EntitySet class has several non-exported methods, the are
considered "private" and as such their APIs are subject to change without notice
and not supported; thus the non-exported methods should not be used.
This example uses one of the sample services from the OData.org site show the
use of the odata::EntitySet class, an instance of that class.
package require TclOO
set svc [odata::Service http://services.odata.org/TripPinRESTierService]
set entitySet [$svc query People {$orderby {LastName,FirstName}}]
puts stdout "There are [$entitySet info count] people"
$entitySet entityVar entityDict {
puts stdout "\t User Name is '[dict get $entityDict UserName]'"
}
$entitySet release
OData,
odata::OData
odata::Service
and
odata::Entity
Copyright © 2017 Gerald W. Lester