コード例 #1
0
        public virtual void MarkCommitAsDispatched(ICommit commit)
        {
            if (commit == null)
            {
                throw new ArgumentNullException("commit");
            }

            var patch = new PatchRequest {
                Type = PatchCommandType.Set, Name = "Dispatched", Value = RavenJToken.Parse("true")
            };
            var data = new PatchCommandData {
                Key = commit.ToRavenCommitId(), Patches = new[] { patch }
            };

            Logger.Debug(Messages.MarkingCommitAsDispatched, commit.CommitId, commit.BucketId);

            TryRaven(() =>
            {
                using (TransactionScope scope = OpenCommandScope())
                    using (IDocumentSession session = _store.OpenSession())
                    {
                        session.Advanced.DocumentStore.DatabaseCommands.Batch(new[] { data });
                        session.SaveChanges();
                        scope.Complete();
                        return(true);
                    }
            });
        }