public sealed class LazyDatastoreQuery : IEnumerable<Entity>, IEnumerable
Reference documentation and code samples for the Google Cloud Datastore v1 API class LazyDatastoreQuery.
A Datastore query which is executed lazily. Iterating over this object will provide a sequence of entities; alternatively, all the results can be fetched using GetAllResults(), or for diagnostic use cases the RPC responses can be viewed using AsResponses(). The lazy evaluation is important: if you iterate over the query multiple times, it will execute multiple times, potentially returning different results each time.
Inheritanceobject > LazyDatastoreQuery
public LazyDatastoreQuery(IEnumerable<RunQueryResponse> responses)
Constructs a new instance from the given sequence of responses. This constructor is only present to facilitate testing; application code will normally obtain instances of this class by calling RunQueryLazily(Query, ReadConsistency?, CallSettings).
The responses to return.
The sequence of responses will be returned directly from AsResponses(), and used to lazily construct the other sequences returned by this class. It should not contain any null references.
public IEnumerable<RunQueryResponse> AsResponses()
This method is for advanced use cases only, where more diagnostic information is required; most application code should merely iterate over the query results as Entity values, or call GetAllResults(). The results of this query are returned as a sequence of RunQueryResponse values exactly as returned by the Datastore API.
A sequence of RunQueryResponse values.
public DatastoreQueryResults GetAllResults()
Reads all the results from this query, until either the query-specified limit or end cursor is reached, or there is no more data to read. Note that all the entities are read into memory, so this method is not appropriate for use cases where a query could return a very large number of results. However, it is the simplest approach to use cases where the query is bounded, such as displaying a page of results at a time in a web application.
The complete set of query results.
public IEnumerator<Entity> GetEnumerator()