Querying asynchronous calls using code
The query calls of the Query API from Azure Digital Twins support paging. However, this requires another approach to be used in calling the methods. Until now, we have been calling methods synchronously. Since a call always depends on the availability of the service or the network connectivity, building production solutions requires using asynchronous calls.
Asynchronous calls also allow us to perform paging with the result of a query. Paging does immediately think about a fix number of results by page. In the case of executing queries, we talk more about handling each result from the query. The following example calls a method for each result in the query.
Open the DigitalTwinsManager
class and add the following code inside the class definition, directly under the class properties:
public delegate void QueryResult(BasicDigitalTwin dt);
This code contains the definition of a delegate function. A delegate function describes the format...