我在以编程方式保存内容时遇到问题,我单击了电子邮件上的链接,然后转到该站点,此时CMS已更新。但是,如果再次单击该链接,则会出现以下错误:
无法保存非当前版本
" at Umbraco.Core.Persistence.Repositories.Implement.DocumentRepository.PersistUpdatedItem(IContent entity)\r\n
at Umbraco.Core.Cache.DefaultRepositoryCachePolicy`2.Update(TEntity entity, Action`1 persistUpdated)\r\n
at Umbraco.Core.Persistence.Repositories.Implement.RepositoryBase`2.Save(TEntity entity)\r\n
at Umbraco.Core.Services.Implement.ContentService.<>c__DisplayClass57_0.<CommitDocumentChangesInternal>g__SaveDocument|2(IContent c)\r\n
at Umbraco.Core.Services.Implement.ContentService.CommitDocumentChangesInternal(IScope scope, IContent content, ContentSavingEventArgs saveEventArgs,
IReadOnlyCollection`1 allLangs, Int32 userId, Boolean raiseEvents, Boolean branchOne, Boolean branchRoot)\r\n
at Umbraco.Core.Services.Implement.ContentService.SaveAndPublish(IContent content, String culture, Int32 userId, Boolean raiseEvents)\r\n
at Web.Controller.Controllers.ContactController.CoachConfirmed(String id)
代码在下面
var contentService = Services.ContentService;
var content = contentService.GetById(new Guid(coachDocType));
content.SetValue("numberOfTrainees", newNumberOfSpaces);
content.SetValue("numberOfTraineesFollowing", newNumberOfSpacesTaken);
contentService.SaveAndPublish(content);
在V7中,我曾经能够执行ApplicationContext.Current.Services.ContentService.RePublishAll();,但V8似乎不再具有该选项
任何帮助将不胜感激
乔治
答案 0 :(得分:1)
根据https://github.com/umbraco/Umbraco-CMS/issues/2997,这似乎是Umbraco中的错误,并且该修补程序将在版本8.3.0中推出