Merge branch v8/dev into v8/feature/5170-IPublishedContent

This commit is contained in:
Stephan
2019-04-23 10:47:40 +02:00
104 changed files with 933 additions and 463 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.XPath;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Xml;
@@ -44,6 +45,20 @@ namespace Umbraco.Web.PublishedCache.NuCache
return n?.PublishedModel;
}
public override IPublishedContent GetById(bool preview, Udi contentId)
{
var guidUdi = contentId as GuidUdi;
if (guidUdi == null)
throw new ArgumentException($"Udi must be of type {typeof(GuidUdi).Name}.", nameof(contentId));
if (guidUdi.EntityType != Constants.UdiEntityType.Media)
throw new ArgumentException($"Udi entity type must be \"{Constants.UdiEntityType.Media}\".", nameof(contentId));
// ignore preview, there's only draft for media
var n = _snapshot.Get(guidUdi.Guid);
return n?.PublishedModel;
}
public override bool HasById(bool preview, int contentId)
{
var n = _snapshot.Get(contentId);