From 4f48a4937b1b2f05cd20b2200ae817675c88646d Mon Sep 17 00:00:00 2001 From: patrickdemooij9 Date: Fri, 8 Oct 2021 11:18:00 +0200 Subject: [PATCH] Cherry picked from 4c08b446842dd49e70bdc3d424d1f9d589126976 --- .../DataSource/BTree.ContentDataSerializer.cs | 3 ++- .../Persistence/NuCacheContentRepository.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.ContentDataSerializer.cs b/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.ContentDataSerializer.cs index ee4c1dac1f..460f5158c5 100644 --- a/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.ContentDataSerializer.cs +++ b/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.ContentDataSerializer.cs @@ -31,7 +31,8 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource var templateId = PrimitiveSerializer.Int32.ReadFrom(stream); var properties = _dictionaryOfPropertyDataSerializer?.ReadFrom(stream); // TODO: We don't want to allocate empty arrays var cultureInfos = s_defaultCultureVariationsSerializer.ReadFrom(stream); // TODO: We don't want to allocate empty arrays - return new ContentData(name, urlSegment, versionId, versionDate, writerId, templateId, published, properties, cultureInfos); + var cachedTemplateId = templateId == 0 ? (int?)null : templateId; + return new ContentData(name, urlSegment, versionId, versionDate, writerId, cachedTemplateId, published, properties, cultureInfos); } public void WriteTo(ContentData value, Stream stream) diff --git a/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs b/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs index 70d48ec000..da8da40824 100644 --- a/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs +++ b/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs @@ -830,7 +830,7 @@ AND cmsContentNu.nodeId IS NULL dto.VersionId, dto.EditVersionDate, dto.EditWriterId, - dto.EditTemplateId, + dto.EditTemplateId == 0 ? null : dto.EditTemplateId, published, deserializedContent?.PropertyData, deserializedContent?.CultureData); @@ -859,7 +859,7 @@ AND cmsContentNu.nodeId IS NULL dto.VersionId, dto.PubVersionDate, dto.PubWriterId, - dto.PubTemplateId, + dto.PubTemplateId == 0 ? null : dto.PubTemplateId, published, deserializedContent?.PropertyData, deserializedContent?.CultureData);