Exemple #1
0
        /// <summary>
        /// Notify one subscription
        /// </summary>
        public void Notify <T>(CollectionRawSubscription <T> collectionRawSubscription) where T : class
        {
            if (collectionRawSubscription.LiteCollection is null)
            {
                throw new InvalidOperationException("notification service is not initialized");
            }

            var nextValue = collectionRawSubscription.LiteCollection;

            Task.Run(() => collectionRawSubscription.Observer?.OnNext(nextValue));
        }
Exemple #2
0
        internal void NotifyIfNeeded <T>(CollectionRawSubscription <T> collectionRawSubscription, NotificationCache cache) where T : class
        {
            if (cache.Broadcasts.Contains(collectionRawSubscription.Collection))
            {
                Notify(collectionRawSubscription);
                return;
            }

            if (cache.Collections.Contains(collectionRawSubscription.Collection))
            {
                Notify(collectionRawSubscription);
                return;
            }
        }