示例#1
0
        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;
        }
示例#2
0
 private void SaveSubscriptionConfig(long id, SubscriptionConfig config)
 {
     Database.TransactionalStorage.Batch(accessor => 
         accessor.Lists.Set(Constants.RavenSubscriptionsPrefix, id.ToString("D19"), RavenJObject.FromObject(config), UuidType.Subscriptions));
 }