예제 #1
0
        public static T LoadRevision <T>(this IDocumentSession documentSession, string id, int revision)
        {
            Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(id));
            Guard.Against(documentSession == null, () => new InvalidOperationException("documentSession is null"));
            string revisionDocId = RevisionDocIdGenerator.GetId(id, revision);

            return(documentSession.Load <T>(revisionDocId));
        }
        public static void DeleteRevision(this IDatabaseCommands databaseCommands, string id, int revision, Guid?etag)
        {
            Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(id));
            Guard.Against(databaseCommands == null, () => new InvalidOperationException("session is null"));
            string revisionDocId = RevisionDocIdGenerator.GetId(id, revision);

            databaseCommands.Delete(revisionDocId, etag);
        }
        public static Task <T> LoadRevision <T>(this IAsyncDocumentSession session, string id, int revision,
                                                CancellationToken ct = default(CancellationToken))
        {
            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            var revisionDocId = RevisionDocIdGenerator.GetId(id, revision);

            return(session.LoadAsync <T>(revisionDocId, ct));
        }
예제 #4
0
        public static Task DeleteRevision(this IAsyncDatabaseCommands databaseCommands, string id, int revision,
                                          Guid?etag = default(Guid?), CancellationToken ct = default(CancellationToken))
        {
            if (databaseCommands == null)
            {
                throw new ArgumentNullException(nameof(databaseCommands));
            }
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            var revisionDocId = RevisionDocIdGenerator.GetId(id, revision);

            return(databaseCommands.DeleteAsync(revisionDocId, etag, ct));
        }