📘

Entity Id

The Retrieve command requires the entity identifier (Id) to retrieve an entity record and associated properties.

The retrieve method can use the AllProperties or the PropertySet class to retrieve the details associated with an entity object. Code snippets illustrate the Retrieve method to fetch Work Zone details based on Work Zone Id.

All Properties

The AllProperties class is used to retrieve properties that are children of the object but does not retrieve properties that are grandchildren of the object.

/* workZoneId: auto-generated system id of the WorkZone entity record created */
var workZone = (WorkZone) corrigoService.Retrieve(
   new EntitySpecifier {Id = workZoneId, EntityType = EntityType.WorkZone}, 
   new AllProperties()
);

Specific Properties

Most entities return a default set of properties and the PropertySet class is used to explicitly specify other properties for retrieval. The PropertySet class is most often used in the RetrieveMultiple method to optimize query execution.

Example: The WorkZone entity returns default properties such as TimeZone, LanguageId, SchedulingWindow, etc. To retrieve the Work Zone Number, Billing Account, Contract, etc. these properties need to be explicitly listed via the PropertySet class as illustrated in the sample code.

var workZone = (WorkZone) CorrigoService.Retrieve(
   new EntitySpecifier {Id = workZoneId, EntityType = EntityType.WorkZone}, 
   new PropertySet {Properties = new[] {"Number", "BillingAccount", "Contract"}}
);