/// <summary> /// Attempts to publish the message to a listener. /// </summary> /// <param name="wrapper"></param> /// <param name="message"></param> /// <returns></returns> public static Task PublishAsync(this ServiceReferenceWrapper wrapper, MessageWrapper message) { ServicePartitionKey partitionKey; switch (wrapper.ServiceReference.PartitionKind) { case ServicePartitionKind.Singleton: partitionKey = ServicePartitionKey.Singleton; break; case ServicePartitionKind.Int64Range: partitionKey = new ServicePartitionKey(wrapper.ServiceReference.PartitionKey); break; case ServicePartitionKind.Named: partitionKey = new ServicePartitionKey(wrapper.ServiceReference.PartitionName); break; default: throw new ArgumentOutOfRangeException(); } var client = ServiceProxyFactoryLazy.Value.CreateServiceProxy <ISubscriberService>(wrapper.ServiceReference.ServiceUri, partitionKey); return(client.ReceiveMessageAsync(message)); }
/// <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 bool Equals(ServiceReferenceWrapper other) { if (other?.ServiceReference?.PartitionGuid == null) { return(false); } return(Equals(other.ServiceReference.PartitionGuid, ServiceReference.PartitionGuid)); }
/// <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 bool Equals(ServiceReferenceWrapper other) { return(Equals(other?.GetHashCode(), GetHashCode())); }