public void Unsubscribe(string client, IEnumerable <string> messageTypes) { var ids = messageTypes .Select(m => Subscription.FormatId(Endpoint, m, client)) .ToList(); using (var session = Store.OpenSession()) { ids.ForEach(id => session.Advanced.DatabaseCommands.Delete(id, null)); session.SaveChanges(); } }
void ISubscriptionStorage.Unsubscribe(Address client, IEnumerable <MessageType> messageTypes) { var ids = messageTypes .Select(m => Subscription.FormatId(Endpoint, m, client.ToString())) .ToList(); using (var session = OpenSession()) { ids.ForEach(id => session.Advanced.DatabaseCommands.Delete(id, null)); session.SaveChanges(); } }
public void Subscribe(string client, IEnumerable <string> messageTypes) { var subscriptions = messageTypes.Select(m => new Subscription { Id = Subscription.FormatId(Endpoint, m, client), MessageType = m, Client = client }).ToList(); try { using (var session = Store.OpenSession()) { session.Advanced.UseOptimisticConcurrency = true; subscriptions.ForEach(session.Store); session.SaveChanges(); } } catch (RavenDbExceptions.ConcurrencyException ex) { } }
void ISubscriptionStorage.Subscribe(Address client, IEnumerable <MessageType> messageTypes) { var subscriptions = messageTypes.Select(m => new Subscription { Id = Subscription.FormatId(Endpoint, m, client.ToString()), MessageType = m, Client = client }).ToList(); try { using (var session = OpenSession()) { session.Advanced.UseOptimisticConcurrency = true; subscriptions.ForEach(session.Store); session.SaveChanges(); } } catch (ConcurrencyException ex) { } }