Exemplo 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);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Removes the subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void RemoveSubscription(SubscriptionBase subscription)
 {
     this.subscriptions.Remove(subscription);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds the subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void AddSubscription(SubscriptionBase subscription)
 {
     this.subscriptions.Add(subscription);
 }