예제 #1
0
파일: EventBroker.cs 프로젝트: codeno47/efc
        /// <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);
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Removes the subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void RemoveSubscription(SubscriptionBase subscription)
 {
     this.subscriptions.Remove(subscription);
 }
예제 #3
0
 /// <summary>
 /// Adds the subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void AddSubscription(SubscriptionBase subscription)
 {
     this.subscriptions.Add(subscription);
 }