public long CreateSubscription(SubscriptionCriteria criteria) { long id = -1; Database.TransactionalStorage.Batch(accessor => { id = accessor.General.GetNextIdentityValue(Constants.RavenSubscriptionsPrefix); var config = new SubscriptionConfig { SubscriptionId = id, Criteria = criteria, AckEtag = criteria.StartEtag ?? Etag.Empty, }; SaveSubscriptionConfig(id, config); }); return id; }
private void SaveSubscriptionConfig(long id, SubscriptionConfig config) { Database.TransactionalStorage.Batch(accessor => accessor.Lists.Set(Constants.RavenSubscriptionsPrefix, id.ToString("D19"), RavenJObject.FromObject(config), UuidType.Subscriptions)); }