Example #1
0
        /// <summary>
        /// Returns a observable of cache changes preceeded with the initital cache state
        /// </summary>
        /// <param name="predicate">The result will be filtered using the specfied predicate.</param>
        /// <returns></returns>
        public IObservable <IChangeSet <TObject, TKey> > Connect(Func <TObject, bool> predicate = null)
        {
            return(Observable.Defer(() =>
            {
                var initial = _innerCache.GetInitialUpdates(predicate);
                var changes = Observable.Return(initial).Concat(_changes);

                return (predicate == null ? changes : changes.Filter(predicate))
                .NotEmpty();
            }));
        }