Appccelerate.EventBroker.Matchers.Scope.PublishToChildren.Match C# (CSharp) 메소드

Match() 공개 메소드

Returns whether the publication and subscription match and the event published by the publisher will be relayed to the subscriber.

This is the case if the name of the publisher is a prefix to the name of the subscriber.

public Match ( IPublication publication, ISubscription subscription, EventArgs e ) : bool
publication IPublication The publication.
subscription ISubscription The subscription.
e System.EventArgs The instance containing the event data.
리턴 bool
        public bool Match(IPublication publication, ISubscription subscription, EventArgs e)
        {
            Ensure.ArgumentNotNull(publication, "publication");
            Ensure.ArgumentNotNull(subscription, "subscription");

            object publisher = publication.Publisher;
            object subscriber = subscription.Subscriber;

            string publisherName = publisher is INamedItem ? ((INamedItem)publisher).EventBrokerItemName : string.Empty;
            string subscriberName = subscriber is INamedItem ? ((INamedItem)subscriber).EventBrokerItemName : string.Empty;

            return subscriberName.StartsWith(publisherName, StringComparison.Ordinal);
        }
PublishToChildren