Skip to content

Commit

Permalink
Merge branch 'v9/dev' into v10/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldbarendse committed Feb 9, 2023
2 parents da5bb71 + 85044bc commit f979838
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,17 @@ public abstract class BlockEditorValueConnector : ValueConnectorBase
private readonly ILogger<BlockEditorValueConnector> _logger;

/// <inheritdoc />
public override IEnumerable<string> PropertyEditorAliases { get; } = new[]
{
"Umbraco.BlockEditor"
};
public override IEnumerable<string> PropertyEditorAliases { get; } = Enumerable.Empty<string>();

// cannot inject ValueConnectorCollection directly as it would cause a circular (recursive) dependency,
// so we have to inject it lazily and use the lazy value when actually needing it
private ValueConnectorCollection ValueConnectors => _valueConnectorsLazy.Value;

public BlockEditorValueConnector(IContentTypeService contentTypeService, Lazy<ValueConnectorCollection> valueConnectors, ILogger<BlockEditorValueConnector> logger)
{
if (contentTypeService == null) throw new ArgumentNullException(nameof(contentTypeService));
if (valueConnectors == null) throw new ArgumentNullException(nameof(valueConnectors));
if (logger == null) throw new ArgumentNullException(nameof(logger));
_contentTypeService = contentTypeService;
_valueConnectorsLazy = valueConnectors;
_logger = logger;
_contentTypeService = contentTypeService ?? throw new ArgumentNullException(nameof(contentTypeService));
_valueConnectorsLazy = valueConnectors ?? throw new ArgumentNullException(nameof(valueConnectors));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

public override string ToArtifact(object value, IPropertyType propertyType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ namespace Umbraco.Deploy.Contrib.ValueConnectors
/// </summary>
public class BlockListValueConnector : BlockEditorValueConnector
{
public override IEnumerable<string> PropertyEditorAliases => new[] { "Umbraco.BlockList" };
public override IEnumerable<string> PropertyEditorAliases { get; } = new[]
{
"Umbraco.BlockList"
};

public BlockListValueConnector(IContentTypeService contentTypeService, Lazy<ValueConnectorCollection> valueConnectors, ILogger<BlockListValueConnector> logger)
: base(contentTypeService, valueConnectors, logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ public MultiUrlPickerValueConnector(
ILogger<MultiUrlPickerValueConnector> logger,
MediaUrlGeneratorCollection mediaUrlGenerators)
{
if (entityService == null) throw new ArgumentNullException(nameof(entityService));
if (mediaService == null) throw new ArgumentNullException(nameof(mediaService));
_entityService = entityService;
_mediaService = mediaService;
_logger = logger;
_entityService = entityService ?? throw new ArgumentNullException(nameof(entityService));
_mediaService = mediaService ?? throw new ArgumentNullException(nameof(mediaService));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_mediaUrlGenerators = mediaUrlGenerators;
}

Expand Down Expand Up @@ -93,7 +91,7 @@ public sealed override string ToArtifact(object value, IPropertyType propertyTyp
: UmbracoObjectTypes.Document;
var entityType = isMedia ? Constants.UdiEntityType.Media : Constants.UdiEntityType.Document;

var guidAttempt = _entityService.GetKey(intId, objectTypeId);
var guidAttempt = contextCache.GetEntityKeyById(_entityService, intId, objectTypeId);
if (guidAttempt.Success == false)
continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ public class NestedContentValueConnector : ValueConnectorBase

public NestedContentValueConnector(IContentTypeService contentTypeService, Lazy<ValueConnectorCollection> valueConnectors, ILogger<NestedContentValueConnector> logger)
{
if (contentTypeService == null) throw new ArgumentNullException(nameof(contentTypeService));
if (valueConnectors == null) throw new ArgumentNullException(nameof(valueConnectors));
if (logger == null) throw new ArgumentNullException(nameof(logger));
_contentTypeService = contentTypeService;
_valueConnectorsLazy = valueConnectors;
_logger = logger;
_contentTypeService = contentTypeService ?? throw new ArgumentNullException(nameof(contentTypeService));
_valueConnectorsLazy = valueConnectors ?? throw new ArgumentNullException(nameof(valueConnectors));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

public sealed override string ToArtifact(object value, IPropertyType propertyType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
Expand Down

0 comments on commit f979838

Please sign in to comment.