Merge remote-tracking branch 'origin/v9/dev' into v10/dev
# Conflicts: # build/azure-pipelines.yml # src/Umbraco.Core/Routing/DefaultUrlProvider.cs # src/Umbraco.Core/Routing/UrlProviderExtensions.cs # src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs # src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs # src/Umbraco.Infrastructure/Services/Implement/ContentService.cs # src/Umbraco.PublishedCache.NuCache/DataSource/BTree.ContentDataSerializer.cs # src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs # src/Umbraco.Web.UI.Client/package-lock.json # tests/Umbraco.Tests.AcceptanceTest/package-lock.json # tests/Umbraco.Tests.AcceptanceTest/package.json # tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs
This commit is contained in:
@@ -13,11 +13,11 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
_dictionaryOfPropertyDataSerializer = dictionaryOfPropertyDataSerializer;
|
||||
if(_dictionaryOfPropertyDataSerializer == null)
|
||||
{
|
||||
_dictionaryOfPropertyDataSerializer = DefaultPropertiesSerializer;
|
||||
_dictionaryOfPropertyDataSerializer = s_defaultPropertiesSerializer;
|
||||
}
|
||||
}
|
||||
private static readonly DictionaryOfPropertyDataSerializer DefaultPropertiesSerializer = new DictionaryOfPropertyDataSerializer();
|
||||
private static readonly DictionaryOfCultureVariationSerializer DefaultCultureVariationsSerializer = new DictionaryOfCultureVariationSerializer();
|
||||
private static readonly DictionaryOfPropertyDataSerializer s_defaultPropertiesSerializer = new DictionaryOfPropertyDataSerializer();
|
||||
private static readonly DictionaryOfCultureVariationSerializer s_defaultCultureVariationsSerializer = new DictionaryOfCultureVariationSerializer();
|
||||
private readonly IDictionaryOfPropertyDataSerializer _dictionaryOfPropertyDataSerializer;
|
||||
|
||||
public ContentData ReadFrom(Stream stream)
|
||||
@@ -29,18 +29,9 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
var versionDate = PrimitiveSerializer.DateTime.ReadFrom(stream);
|
||||
var writerId = PrimitiveSerializer.Int32.ReadFrom(stream);
|
||||
var templateId = PrimitiveSerializer.Int32.ReadFrom(stream);
|
||||
return new ContentData
|
||||
{
|
||||
Published = published,
|
||||
Name = name,
|
||||
UrlSegment = urlSegment,
|
||||
VersionId = versionId,
|
||||
VersionDate = versionDate,
|
||||
WriterId = writerId,
|
||||
TemplateId = templateId == 0 ? (int?)null : templateId,
|
||||
Properties = _dictionaryOfPropertyDataSerializer.ReadFrom(stream), // TODO: We don't want to allocate empty arrays
|
||||
CultureInfos = DefaultCultureVariationsSerializer.ReadFrom(stream) // TODO: We don't want to allocate empty arrays
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
public void WriteTo(ContentData value, Stream stream)
|
||||
@@ -53,7 +44,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
PrimitiveSerializer.Int32.WriteTo(value.WriterId, stream);
|
||||
PrimitiveSerializer.Int32.WriteTo(value.TemplateId ?? 0, stream);
|
||||
_dictionaryOfPropertyDataSerializer.WriteTo(value.Properties, stream);
|
||||
DefaultCultureVariationsSerializer.WriteTo(value.CultureInfos, stream);
|
||||
s_defaultCultureVariationsSerializer.WriteTo(value.CultureInfos, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using CSharpTest.Net.Serialization;
|
||||
|
||||
namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
@@ -10,19 +10,17 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
_contentDataSerializer = contentDataSerializer;
|
||||
if(_contentDataSerializer == null)
|
||||
{
|
||||
_contentDataSerializer = DefaultDataSerializer;
|
||||
_contentDataSerializer = s_defaultDataSerializer;
|
||||
}
|
||||
}
|
||||
static readonly ContentDataSerializer DefaultDataSerializer = new ContentDataSerializer();
|
||||
static readonly ContentDataSerializer s_defaultDataSerializer = new ContentDataSerializer();
|
||||
private readonly ContentDataSerializer _contentDataSerializer;
|
||||
|
||||
//static readonly ListOfIntSerializer ChildContentIdsSerializer = new ListOfIntSerializer();
|
||||
|
||||
public ContentNodeKit ReadFrom(Stream stream)
|
||||
{
|
||||
var kit = new ContentNodeKit
|
||||
{
|
||||
Node = new ContentNode(
|
||||
var contentNode = new ContentNode(
|
||||
PrimitiveSerializer.Int32.ReadFrom(stream), // id
|
||||
PrimitiveSerializer.Guid.ReadFrom(stream), // uid
|
||||
PrimitiveSerializer.Int32.ReadFrom(stream), // level
|
||||
@@ -31,15 +29,27 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
PrimitiveSerializer.Int32.ReadFrom(stream), // parent id
|
||||
PrimitiveSerializer.DateTime.ReadFrom(stream), // date created
|
||||
PrimitiveSerializer.Int32.ReadFrom(stream) // creator id
|
||||
),
|
||||
ContentTypeId = PrimitiveSerializer.Int32.ReadFrom(stream)
|
||||
};
|
||||
);
|
||||
|
||||
int contentTypeId = PrimitiveSerializer.Int32.ReadFrom(stream);
|
||||
var hasDraft = PrimitiveSerializer.Boolean.ReadFrom(stream);
|
||||
ContentData draftData = null;
|
||||
ContentData publishedData = null;
|
||||
if (hasDraft)
|
||||
kit.DraftData = _contentDataSerializer.ReadFrom(stream);
|
||||
{
|
||||
draftData = _contentDataSerializer.ReadFrom(stream);
|
||||
}
|
||||
var hasPublished = PrimitiveSerializer.Boolean.ReadFrom(stream);
|
||||
if (hasPublished)
|
||||
kit.PublishedData = _contentDataSerializer.ReadFrom(stream);
|
||||
{
|
||||
publishedData = _contentDataSerializer.ReadFrom(stream);
|
||||
}
|
||||
var kit = new ContentNodeKit(
|
||||
contentNode,
|
||||
contentTypeId,
|
||||
draftData,
|
||||
publishedData);
|
||||
|
||||
return kit;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,19 +8,38 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource
|
||||
/// </summary>
|
||||
public class ContentData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string UrlSegment { get; set; }
|
||||
public int VersionId { get; set; }
|
||||
public DateTime VersionDate { get; set; }
|
||||
public int WriterId { get; set; }
|
||||
public int? TemplateId { get; set; }
|
||||
public bool Published { get; set; }
|
||||
[Obsolete("Use ctor with all params, as the pros should be immutable")]
|
||||
public ContentData()
|
||||
{
|
||||
|
||||
public IDictionary<string, PropertyData[]> Properties { get; set; }
|
||||
}
|
||||
|
||||
public ContentData(string name, string urlSegment, int versionId, DateTime versionDate, int writerId, int? templateId, bool published, IDictionary<string, PropertyData[]> properties, IReadOnlyDictionary<string, CultureVariation> cultureInfos)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
UrlSegment = urlSegment;
|
||||
VersionId = versionId;
|
||||
VersionDate = versionDate;
|
||||
WriterId = writerId;
|
||||
TemplateId = templateId;
|
||||
Published = published;
|
||||
Properties = properties ?? throw new ArgumentNullException(nameof(properties));
|
||||
CultureInfos = cultureInfos;
|
||||
}
|
||||
|
||||
public string Name { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
public string UrlSegment { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
public int VersionId { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
public DateTime VersionDate { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
public int WriterId { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
public int? TemplateId { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
public bool Published { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
|
||||
public IDictionary<string, PropertyData[]> Properties { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
|
||||
/// <summary>
|
||||
/// The collection of language Id to name for the content item
|
||||
/// </summary>
|
||||
public IReadOnlyDictionary<string, CultureVariation> CultureInfos { get; set; }
|
||||
public IReadOnlyDictionary<string, CultureVariation> CultureInfos { get; [Obsolete("Do not change this, use ctor with params and have this object immutable.")] set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user