コード例 #1
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public override bool Equals(ReferenceWrapper other)
 {
     return(Equals(other as ServiceReferenceWrapper));
 }
コード例 #2
0
 public static string CreateQueueName(ReferenceWrapper referenceWrapper, string messageTypeName)
 {
     return($"{messageTypeName}_{referenceWrapper.GetQueueName()}");
 }
コード例 #3
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public override bool Equals(ReferenceWrapper other)
 {
     return(Equals(other as ActorReferenceWrapper));
 }
コード例 #4
0
        /// <summary>
        /// Returns a cloned instance with the same subscribers as the original, minus the new <paramref name="subscriber"/>
        /// </summary>
        /// <param name="current"></param>
        /// <param name="subscriber"></param>
        /// <returns></returns>
        public static BrokerServiceState RemoveSubscriber(BrokerServiceState current, ReferenceWrapper subscriber)
        {
            if (current == null)
            {
                throw new ArgumentNullException(nameof(current));
            }
            if (subscriber == null)
            {
                throw new ArgumentNullException(nameof(subscriber));
            }

            if (current.Subscribers.All(s => !s.ServiceOrActorReference.Equals(subscriber)))
            {
                return(current);
            }

            var clone = new BrokerServiceState(current.MessageTypeName, ((ImmutableList <SubscriptionDetails>)current.Subscribers).RemoveAll(s => s.ServiceOrActorReference.Equals(subscriber)));

            return(clone);
        }