Files
Umbraco-CMS/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorValidator.cs
Bjarke Berg 0aaac78cfa A bunch of minor performance optimizations (#16335)
* Do not execute query if no macros found

* Request cache the permission lookup

* Unbreak change by adding obsolete ctor

* Clean up

* Wrap indexing for delivery API in a scope

* Do not ask options every time for the timeout, instead listen for updates

* Lookup content types once instead of one by one

* Use TryGetValue instead

* Do a distinct on user ids before building index, to avoid issue with more than 2100 parameters

* Don't map ContentDto (it's unused)

* Introduce request bound block editor element cache

---------

Co-authored-by: kjac <kja@umbraco.dk>
2024-06-03 11:23:25 +02:00

29 lines
1022 B
C#

// Copyright (c) Umbraco.
// See LICENSE for more details.
using Umbraco.Cms.Core.Cache.PropertyEditors;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Core.PropertyEditors;
internal class BlockEditorValidator : BlockEditorValidatorBase
{
private readonly BlockEditorValues _blockEditorValues;
public BlockEditorValidator(
IPropertyValidationService propertyValidationService,
BlockEditorValues blockEditorValues,
IBlockEditorElementTypeCache elementTypeCache)
: base(propertyValidationService, elementTypeCache)
=> _blockEditorValues = blockEditorValues;
protected override IEnumerable<ElementTypeValidationModel> GetElementTypeValidation(object? value)
{
BlockEditorData? blockEditorData = _blockEditorValues.DeserializeAndClean(value);
return blockEditorData is not null
? GetBlockEditorDataValidation(blockEditorData)
: Array.Empty<ElementTypeValidationModel>();
}
}