예제 #1
0
        public JObject Revert(Guid id, string contentType, int version)
        {
            if (!area.HistoryEnabled)
            {
                throw new InvalidOperationException("Cannot revert document when history is not enabled.");
            }

            return(performance.TrackFunction(() =>
            {
                JObject current = area.Get(id);
                using (PipelineContext context = pipeline.CreateContext(contentType, current))
                {
                    JObject entity = area.History.Get(id, version);
                    entity = pipeline.ExecuteBeforeRevert(entity, current, contentType, context);
                    area.Update(id, entity);
                    entity = pipeline.ExecuteAfterRevert(entity, current, contentType, context);
                    manager.QueueUpdate(entity);
                    return entity;
                }
            }, TRACK_TYPE, new { fn = $"ContentService.Revert({id}, {contentType}, {version})" }));
        }