Esempio n. 1
0
        /// <summary>
        /// Unsubscribes for.
        /// </summary>
        /// <param name="subject">The subject.</param>
        /// <param name="predicate">The predicate.</param>
        private void RemoveSubscriptionFor(string subject, Func <SubscriptionBase, bool> predicate)
        {
            lock (this.subjects)
            {
                EventSubject     publishedEvent       = this.GetEvent(subject);
                SubscriptionBase subscriptionToRemove = publishedEvent.Subscriptions.LastOrDefault(predicate);

                if (subscriptionToRemove != null)
                {
                    publishedEvent.RemoveSubscription(subscriptionToRemove);

                    this.RemoveEventSubjectIfEmpty(publishedEvent);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Removes the subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void RemoveSubscription(SubscriptionBase subscription)
 {
     this.subscriptions.Remove(subscription);
 }
Esempio n. 3
0
 /// <summary>
 /// Adds the subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void AddSubscription(SubscriptionBase subscription)
 {
     this.subscriptions.Add(subscription);
 }