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