示例#1
0
        public IAsyncOperation<ItemDataTypedList> GetAsync(ItemQuery query)
        {
            query.ValidateRequired("query");
            //
            // Ensure the user is querying for typed information
            //
            if (!query.View.ReturnsTypedData)
            {
                throw new ArgumentException("query");
            }

            return AsyncInfo.Run(
                async cancelToken =>
                      {
                          ItemQueryResult[] results = await ExecuteQueriesAsync(cancelToken, new[] {query});
                          if (results.IsNullOrEmpty())
                          {
                              return null;
                          }

                          ItemQueryResult result = results[0];
                          return new ItemDataTypedList(this, query.View, result.Items, result.PendingKeys);
                      });
        }
示例#2
0
        internal async Task<ItemQueryResult[]> ExecuteQueriesAsync(CancellationToken cancelToken, ItemQuery[] queries)
        {
            queries.ValidateRequired<ItemQuery>("queries");

            RecordQueryResponse queryResponse =
                await Client.RecordMethods.GetThingsAsync<RecordQueryResponse>(m_recordRef, queries, cancelToken);
            return queryResponse.Results;
        }