/// <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));
 }
 public Reference(ReferenceWrapper serviceOrActorReference, string queueName)
 {
     ServiceOrActorReference = serviceOrActorReference;
     QueueName = queueName;
 }
        /// <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 <Reference>)current.Subscribers).RemoveAll(s => s.ServiceOrActorReference.Equals(subscriber)));

            return(clone);
        }
Beispiel #4
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));
 }