public ViewData(ItemQuery query, string name) : this() { if (query == null) { throw new ArgumentNullException("query"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException("name"); } Query = query; Name = name; }
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); }); }
public ViewData(ItemQuery query) : this(query, query.Name) { }
public static ItemQuery QueryForKeys(IList<ItemFilter> filters, int maxResults) { filters.ValidateRequired("filter"); var query = new ItemQuery(); query.View.SetSections(ItemSectionType.Core); query.Filters.AddRange(filters); query.MaxFullItems = new NonNegativeInt(0); if (maxResults > 0) { query.MaxResults = new NonNegativeInt(maxResults); } return query; }
public static ItemQuery QueryForKeys(IEnumerable<ItemKey> keys) { if (keys == null) { throw new ArgumentNullException("keys"); } var query = new ItemQuery(); query.Keys = keys.ToArray(); return query; }
public static ItemQuery QueryForKey(ItemKey key) { if (key == null) { throw new ArgumentNullException("key"); } var query = new ItemQuery(); query.Keys = new[] {key}; return query; }
//------------------------------------------------------------------ // // Factory methods // Constructor overloading in WinRT is limited // //------------------------------------------------------------------ public static ItemQuery QueryForTypeID(string typeID) { var query = new ItemQuery(); query.Name = typeID; query.Filters.Add(ItemFilter.FilterForType(typeID)); query.View.TypeVersions.Add(typeID); return query; }
public ItemDataTypedList ToItemDataTypedList(IRecord record, ItemQuery originalQuery) { if (record == null) { throw new ArgumentNullException("record"); } if (originalQuery == null) { throw new ArgumentNullException("originalQuery"); } return new ItemDataTypedList(record, originalQuery.View, Items, PendingKeys); }
public IAsyncOperation<ItemQueryResult> GetItemsAsync(ItemQuery query) { return AsyncInfo.Run( async cancelToken => { ItemQueryResult[] results = await ExecuteQueriesAsync(cancelToken, new[] {query}); return (results.IsNullOrEmpty()) ? null : results[0]; }); }
public IAsyncOperation<IList<RecordItem>> GetAllItemsAsync(ItemQuery query) { this.ProduceError(); return m_innerStore.GetAllItemsAsync(query); }
public SynchronizedView CreateView(string viewName, ItemQuery query) { if (string.IsNullOrEmpty(viewName)) { throw new ArgumentException("viewName"); } return new SynchronizedView(m_dataStore, query, viewName); }
public SynchronizedView CreateView(ItemQuery query) { return new SynchronizedView(m_dataStore, query, query.Name); }
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; }
internal async Task<IList<RecordItem>> GetAllItemsAsync(CancellationToken cancelToken, ItemQuery query) { var itemsFound = new List<RecordItem>(); while (true) { ItemQueryResult[] results = await ExecuteQueriesAsync(cancelToken, new[] {query}); if (results.IsNullOrEmpty()) { break; } ItemQueryResult result = results[0]; if (result.HasItems) { itemsFound.AddRange(result.Items); } if (!result.HasPending) { break; } // // Issue a fresh query for pending items // ItemQuery pendingQuery = ItemQuery.QueryForPending(result.PendingItems); pendingQuery.View = query.View; query = pendingQuery; } return itemsFound; }
public IAsyncOperation<IList<RecordItem>> GetAllItemsAsync(ItemQuery query) { return AsyncInfo.Run(cancelToken => GetAllItemsAsync(cancelToken, query)); }
public IAsyncOperation<IList<RecordItem>> GetAllItemsAsync(ItemQuery query) { return m_record.GetAllItemsAsync(query); }
public SynchronizedView(SynchronizedStore store, ItemQuery query, string name) : this(store, new ViewData(query, name)) { }
async Task<IList<RecordItem>> LookupCommitsInRemoteStoreAsync(params string[] changeIDs) { ItemQuery query = new ItemQuery(); query.View.SetSections(ItemSectionType.Core); query.MaxFullItems = new NonNegativeInt(0); query.MaxResults = new NonNegativeInt(changeIDs.Length); query.ClientIDs = changeIDs.ToArray(); return await m_store.RemoteStore.GetAllItemsAsync(query); }