diff --git a/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs
index 865d50afbc..024e533fb3 100644
--- a/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs
@@ -13,6 +13,8 @@ namespace Umbraco.Cms.Core.Configuration.Models
///
public int? BTreeBlockSize { get; set; }
+ // TODO: Set default to MessagePack
+
///
/// The serializer type that nucache uses to persist documents in the database.
///
diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
index c513e9910b..f9fde4c47e 100644
--- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
+++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
@@ -29,6 +29,8 @@ using Umbraco.Cms.Core.Manifest;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.PropertyEditors;
+using Umbraco.Cms.Core.PublishedCache;
+using Umbraco.Cms.Core.PublishedCache.Internal;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Runtime;
using Umbraco.Cms.Core.Security;
@@ -229,6 +231,9 @@ namespace Umbraco.Cms.Core.DependencyInjection
.AddNotificationHandler();
Services.AddSingleton();
+
+ // register a basic/noop published snapshot service to be replaced
+ Services.AddSingleton();
}
}
}
diff --git a/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContent.cs b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContent.cs
new file mode 100644
index 0000000000..34152ebc0f
--- /dev/null
+++ b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContent.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Umbraco.Cms.Core.Models.PublishedContent;
+using Umbraco.Extensions;
+
+namespace Umbraco.Cms.Core.PublishedCache.Internal
+{
+
+ public sealed class InternalPublishedContent : IPublishedContent
+ {
+ public InternalPublishedContent(IPublishedContentType contentType)
+ {
+ // initialize boring stuff
+ TemplateId = 0;
+ WriterId = CreatorId = 0;
+ CreateDate = UpdateDate = DateTime.Now;
+ Version = Guid.Empty;
+
+ ContentType = contentType;
+ }
+
+ private Dictionary _cultures;
+
+ private Dictionary GetCultures() => new Dictionary { { string.Empty, new PublishedCultureInfo(string.Empty, Name, UrlSegment, UpdateDate) } };
+
+ public int Id { get; set; }
+
+ public Guid Key { get; set; }
+
+ public int? TemplateId { get; set; }
+
+ public int SortOrder { get; set; }
+
+ public string Name { get; set; }
+
+ public IReadOnlyDictionary Cultures => _cultures ??= GetCultures();
+
+ public string UrlSegment { get; set; }
+
+ public int WriterId { get; set; }
+
+ public int CreatorId { get; set; }
+
+ public string Path { get; set; }
+
+ public DateTime CreateDate { get; set; }
+
+ public DateTime UpdateDate { get; set; }
+
+ public Guid Version { get; set; }
+
+ public int Level { get; set; }
+
+ public PublishedItemType ItemType => PublishedItemType.Content;
+
+ public bool IsDraft(string culture = null) => false;
+
+ public bool IsPublished(string culture = null) => true;
+
+ public int ParentId { get; set; }
+
+ public IEnumerable ChildIds { get; set; }
+
+ public IPublishedContent Parent { get; set; }
+
+ public IEnumerable Children { get; set; }
+
+ public IEnumerable ChildrenForAllCultures => Children;
+
+ public IPublishedContentType ContentType { get; set; }
+
+ public IEnumerable Properties { get; set; }
+
+ public IPublishedProperty GetProperty(string alias) => Properties.FirstOrDefault(p => p.Alias.InvariantEquals(alias));
+
+ public IPublishedProperty GetProperty(string alias, bool recurse)
+ {
+ IPublishedProperty property = GetProperty(alias);
+ if (recurse == false)
+ {
+ return property;
+ }
+
+ IPublishedContent content = this;
+ while (content != null && (property == null || property.HasValue() == false))
+ {
+ content = content.Parent;
+ property = content?.GetProperty(alias);
+ }
+
+ return property;
+ }
+
+ public object this[string alias]
+ {
+ get
+ {
+ var property = GetProperty(alias);
+ return property == null || property.HasValue() == false ? null : property.GetValue();
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContentCache.cs b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContentCache.cs
new file mode 100644
index 0000000000..2a197affff
--- /dev/null
+++ b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContentCache.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Umbraco.Cms.Core.Models.PublishedContent;
+using Umbraco.Cms.Core.Xml;
+
+namespace Umbraco.Cms.Core.PublishedCache.Internal
+{
+ public sealed class InternalPublishedContentCache : PublishedCacheBase, IPublishedContentCache, IPublishedMediaCache
+ {
+ private readonly Dictionary _content = new Dictionary();
+
+ public InternalPublishedContentCache()
+ : base(false)
+ {
+ }
+
+ //public void Add(InternalPublishedContent content) => _content[content.Id] = content.CreateModel(Mock.Of());
+
+ public void Clear() => _content.Clear();
+
+ public IPublishedContent GetByRoute(bool preview, string route, bool? hideTopLevelNode = null, string culture = null) => throw new NotImplementedException();
+
+ public IPublishedContent GetByRoute(string route, bool? hideTopLevelNode = null, string culture = null) => throw new NotImplementedException();
+
+ public string GetRouteById(bool preview, int contentId, string culture = null) => throw new NotImplementedException();
+
+ public string GetRouteById(int contentId, string culture = null) => throw new NotImplementedException();
+
+ public override IPublishedContent GetById(bool preview, int contentId) => _content.ContainsKey(contentId) ? _content[contentId] : null;
+
+ public override IPublishedContent GetById(bool preview, Guid contentId) => throw new NotImplementedException();
+
+ public override IPublishedContent GetById(bool preview, Udi nodeId) => throw new NotSupportedException();
+
+ public override bool HasById(bool preview, int contentId) => _content.ContainsKey(contentId);
+
+ public override IEnumerable GetAtRoot(bool preview, string culture = null) => _content.Values.Where(x => x.Parent == null);
+
+ public override IPublishedContent GetSingleByXPath(bool preview, string xpath, XPathVariable[] vars) => throw new NotImplementedException();
+
+ public override IPublishedContent GetSingleByXPath(bool preview, System.Xml.XPath.XPathExpression xpath, XPathVariable[] vars) => throw new NotImplementedException();
+
+ public override IEnumerable GetByXPath(bool preview, string xpath, XPathVariable[] vars) => throw new NotImplementedException();
+
+ public override IEnumerable GetByXPath(bool preview, System.Xml.XPath.XPathExpression xpath, XPathVariable[] vars) => throw new NotImplementedException();
+
+ public override System.Xml.XPath.XPathNavigator CreateNavigator(bool preview) => throw new NotImplementedException();
+
+ public override System.Xml.XPath.XPathNavigator CreateNodeNavigator(int id, bool preview) => throw new NotImplementedException();
+
+ public override bool HasContent(bool preview) => _content.Count > 0;
+
+ public override IPublishedContentType GetContentType(int id) => throw new NotImplementedException();
+
+ public override IPublishedContentType GetContentType(string alias) => throw new NotImplementedException();
+
+ public override IPublishedContentType GetContentType(Guid key) => throw new NotImplementedException();
+
+ public override IEnumerable GetByContentType(IPublishedContentType contentType) => throw new NotImplementedException();
+ }
+}
diff --git a/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedProperty.cs b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedProperty.cs
new file mode 100644
index 0000000000..a98eff6484
--- /dev/null
+++ b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedProperty.cs
@@ -0,0 +1,27 @@
+using Umbraco.Cms.Core.Models.PublishedContent;
+
+namespace Umbraco.Cms.Core.PublishedCache.Internal
+{
+ public class InternalPublishedProperty : IPublishedProperty
+ {
+ public IPublishedPropertyType PropertyType { get; set; }
+
+ public string Alias { get; set; }
+
+ public object SolidSourceValue { get; set; }
+
+ public object SolidValue { get; set; }
+
+ public bool SolidHasValue { get; set; }
+
+ public object SolidXPathValue { get; set; }
+
+ public virtual object GetSourceValue(string culture = null, string segment = null) => SolidSourceValue;
+
+ public virtual object GetValue(string culture = null, string segment = null) => SolidValue;
+
+ public virtual object GetXPathValue(string culture = null, string segment = null) => SolidXPathValue;
+
+ public virtual bool HasValue(string culture = null, string segment = null) => SolidHasValue;
+ }
+}
diff --git a/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedSnapshot.cs b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedSnapshot.cs
new file mode 100644
index 0000000000..c73b6cef76
--- /dev/null
+++ b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedSnapshot.cs
@@ -0,0 +1,33 @@
+using System;
+using Umbraco.Cms.Core.Cache;
+
+namespace Umbraco.Cms.Core.PublishedCache.Internal
+{
+ public sealed class InternalPublishedSnapshot : IPublishedSnapshot
+ {
+ public InternalPublishedContentCache InnerContentCache { get; } = new InternalPublishedContentCache();
+ public InternalPublishedContentCache InnerMediaCache { get; } = new InternalPublishedContentCache();
+
+ public IPublishedContentCache Content => InnerContentCache;
+
+ public IPublishedMediaCache Media => InnerMediaCache;
+
+ public IPublishedMemberCache Members => null;
+
+ public IDomainCache Domains => null;
+
+ public IDisposable ForcedPreview(bool forcedPreview, Action callback = null) => throw new NotImplementedException();
+
+ public void Resync()
+ {
+ }
+
+ public IAppCache SnapshotCache => null;
+
+ public IAppCache ElementsCache => null;
+
+ public void Dispose()
+ {
+ }
+ }
+}
diff --git a/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedSnapshotService.cs b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedSnapshotService.cs
new file mode 100644
index 0000000000..5dcdc5189f
--- /dev/null
+++ b/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedSnapshotService.cs
@@ -0,0 +1,60 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Umbraco.Cms.Core.Cache;
+using Umbraco.Extensions;
+
+namespace Umbraco.Cms.Core.PublishedCache.Internal
+{
+ public class InternalPublishedSnapshotService : IPublishedSnapshotService
+ {
+ private InternalPublishedSnapshot _snapshot;
+ private InternalPublishedSnapshot _previewSnapshot;
+
+ public Task CollectAsync() => Task.CompletedTask;
+
+ public IPublishedSnapshot CreatePublishedSnapshot(string previewToken)
+ {
+ if (previewToken.IsNullOrWhiteSpace())
+ {
+ return _snapshot ??= new InternalPublishedSnapshot();
+ }
+ else
+ {
+ return _previewSnapshot ??= new InternalPublishedSnapshot();
+ }
+ }
+
+ public void Dispose()
+ {
+ _snapshot?.Dispose();
+ _previewSnapshot?.Dispose();
+ }
+
+ public void Notify(ContentCacheRefresher.JsonPayload[] payloads, out bool draftChanged, out bool publishedChanged)
+ {
+ draftChanged = false;
+ publishedChanged = false;
+ }
+
+ public void Notify(MediaCacheRefresher.JsonPayload[] payloads, out bool anythingChanged)
+ {
+ anythingChanged = false;
+ }
+
+ public void Notify(ContentTypeCacheRefresher.JsonPayload[] payloads)
+ {
+ }
+
+ public void Notify(DataTypeCacheRefresher.JsonPayload[] payloads)
+ {
+ }
+
+ public void Notify(DomainCacheRefresher.JsonPayload[] payloads)
+ {
+ }
+
+ public void Rebuild(IReadOnlyCollection contentTypeIds = null, IReadOnlyCollection mediaTypeIds = null, IReadOnlyCollection memberTypeIds = null)
+ {
+ }
+ }
+}
diff --git a/src/Umbraco.Persistence.SqlCe/SqlCeImageMapper.cs b/src/Umbraco.Persistence.SqlCe/SqlCeImageMapper.cs
index 28b2d6a185..8349056440 100644
--- a/src/Umbraco.Persistence.SqlCe/SqlCeImageMapper.cs
+++ b/src/Umbraco.Persistence.SqlCe/SqlCeImageMapper.cs
@@ -17,9 +17,9 @@ namespace Umbraco.Cms.Persistence.SqlCe
///
public class SqlCeImageMapper : DefaultMapper
{
- private readonly IUmbracoDatabaseFactory _dbFactory;
+ //private readonly IUmbracoDatabaseFactory _dbFactory;
- public SqlCeImageMapper(IUmbracoDatabaseFactory dbFactory) => _dbFactory = dbFactory;
+ //public SqlCeImageMapper(IUmbracoDatabaseFactory dbFactory) => _dbFactory = dbFactory;
public override Func