/// <summary> /// Called when the underlying query changes. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The arguments.</param> private void OnChanged(object sender, QueryChangeEventArgs args) { // $todo(jeff.lill): // // For now, I'm simply going to update the entire collection. In the future, // it may be possible to compare the current collection with the new query // results to try to minimize the changes. This could result in a better // user experience. rowList.Clear(); foreach (var row in liveQuery.Rows) { var entityRow = new EntityQueryRow <TEntity>(row); if (postFilter != null && !postFilter(entityRow)) { continue; } rowList.Add(entityRow); } CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); }
/// <inheritdoc/> IEnumerator IEnumerable.GetEnumerator() { foreach (var row in Base) { var entityRow = new EntityQueryRow <TEntity>(row); if (postFilter != null && !postFilter(entityRow)) { continue; } yield return(entityRow); } }
/// <inheritdoc/> public bool Remove(EntityQueryRow <TEntity> item) { throw new InvalidOperationException(ReadOnlyError); }
/// <inheritdoc/> public bool Contains(EntityQueryRow <TEntity> item) { return(rowList.Contains(item)); }
/// <inheritdoc/> public void Add(EntityQueryRow <TEntity> item) { throw new InvalidOperationException(ReadOnlyError); }
/// <inheritdoc/> public void Insert(int index, EntityQueryRow <TEntity> item) { throw new InvalidOperationException(ReadOnlyError); }
/// <inheritdoc/> public int IndexOf(EntityQueryRow <TEntity> item) { return(rowList.IndexOf(item)); }