void ISubscriptionStorage.Subscribe(Address address, IEnumerable<MessageType> messageTypes)
        {
            using (var context = new SubscriptionServiceContext(client))
            {
                foreach (var messageType in messageTypes)
                {
                    try
                    {
                        var subscription = new Subscription
                        {
                            RowKey = EncodeTo64(address.ToString()),
                            PartitionKey = messageType.ToString()
                        };

                        context.AddObject(SubscriptionServiceContext.SubscriptionTableName, subscription);
                        context.SaveChangesWithRetries();
                    }
                    catch (StorageException ex)
                    {
                        if (ex.RequestInformation.HttpStatusCode != 409) throw;
                    }
                   
                }
            }
        }
示例#2
0
 public virtual bool Equals(Subscription other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.RowKey, RowKey) && Equals(other.PartitionKey, PartitionKey);
 }