Query Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The query iterator.
public class Query : IDisposable
public class Query
type Query = class
interface IDisposable
type Query = class
Public Class Query
Implements IDisposable
Public Class Query
- Inheritance
-
Query
- Implements
Remarks
The Query iterator is the result of the query factory for
On all cases, the QuerySpecification contains a SQL query that must follow the Query Language for the Device Provisioning Service.Optionally, an Integer with the page size, can determine the maximum number of the items in the QueryResult returned by the NextAsync(). It must be any positive integer, and if it contains 0, the Device Provisioning Service will ignore it and use a standard page size.
You can use this Object as a standard iterator, just using the HasNext
and NextAsync
in a while
loop, up to the point where the HasNext
contains false. But, keep in mind that the QueryResult can contain a empty list, even if the HasNext
contained true
. For example, image that you have 10 IndividualEnrollment in the Device Provisioning Service and you created new query with the PageSize
equals 5. In the first iteration, HasNext
will contains true
, and the first NextAsync
will return a QueryResult
with 5 items. After, your code will check the HasNext
, which will contains true again. Now, before you get the next page, somebody deletes all the IndividualEnrollment. What happened, when you call the NextAsync
, it will return a valid QueryResult
, but the Items will contain an empty list.
Besides the Items
, the QueryResult
contains the ContinuationToken. You can also store a query context (QuerySpecification + ContinuationToken) and restart it in the future, from the point where you stopped. Just recreating the query with the same QuerySpecification and calling the NextAsync(String) passing the stored ContinuationToken
.
Properties
ContinuationToken |
The token to retrieve the next page. |
PageSize |
The number of items in the current page. |
Methods
Dispose() |
Dispose the HTTP resources. |
Dispose(Boolean) |
Releases the unmanaged resources used by the Component and optionally releases the managed resources. |
HasNext() |
Getter for has next. |
NextAsync() |
Return the next page of result for the query. |
NextAsync(String) |
Return the next page of result for the query using a new continuationToken. |
Applies to
Azure SDK for .NET