diff --git a/src/Umbraco.Core/Deploy/ArtifactBase.cs b/src/Umbraco.Core/Deploy/ArtifactBase.cs index 994297990d..de13e1d298 100644 --- a/src/Umbraco.Core/Deploy/ArtifactBase.cs +++ b/src/Umbraco.Core/Deploy/ArtifactBase.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Core.Deploy; public abstract class ArtifactBase : IArtifact where TUdi : Udi { - private IEnumerable _dependencies; + private IEnumerable? _dependencies; private readonly Lazy _checksum; /// @@ -20,7 +20,7 @@ public abstract class ArtifactBase : IArtifact Udi = udi ?? throw new ArgumentNullException(nameof(udi)); Name = Udi.ToString(); - _dependencies = dependencies ?? Enumerable.Empty(); + _dependencies = dependencies; _checksum = new Lazy(GetChecksum); } @@ -33,8 +33,8 @@ public abstract class ArtifactBase : IArtifact /// public IEnumerable Dependencies { - get => _dependencies; - set => _dependencies = value.OrderBy(x => x.Udi); + get => _dependencies ??= Array.Empty(); + set => _dependencies = value.OrderBy(x => x.Udi).ToArray(); } /// @@ -44,7 +44,7 @@ public abstract class ArtifactBase : IArtifact public string Name { get; set; } /// - public string Alias { get; set; } = string.Empty; + public string? Alias { get; set; } /// /// Gets the checksum. @@ -53,17 +53,4 @@ public abstract class ArtifactBase : IArtifact /// The checksum. /// protected abstract string GetChecksum(); - - /// - /// Prevents the property from being serialized. - /// - /// - /// Returns false to prevent the property from being serialized. - /// - /// - /// Note that we can't use here as that works only on fields, not properties. And we want to avoid using [JsonIgnore] - /// as that would require an external dependency in Umbraco.Cms.Core. - /// So using this method of excluding properties from serialized data, documented here: https://www.newtonsoft.com/json/help/html/ConditionalProperties.htm - /// - public bool ShouldSerializeChecksum() => false; } diff --git a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs index 4cb0690d1f..a293dfd897 100644 --- a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs +++ b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs @@ -39,5 +39,5 @@ public interface IDataTypeConfigurationConnector /// /// The data type configuration. /// - object? FromArtifact(IDataType dataType, string? configuration, IContextCache contextCache); + IDictionary FromArtifact(IDataType dataType, string? configuration, IContextCache contextCache); } diff --git a/src/Umbraco.Core/Deploy/IDeployContext.cs b/src/Umbraco.Core/Deploy/IDeployContext.cs index f706cbd3ae..62a8c39d44 100644 --- a/src/Umbraco.Core/Deploy/IDeployContext.cs +++ b/src/Umbraco.Core/Deploy/IDeployContext.cs @@ -53,9 +53,4 @@ public interface IDeployContext /// T? Item(string key) where T : class; - - ///// - ///// Gets the global deployment cancellation token. - ///// - // CancellationToken CancellationToken { get; } } diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Deploy/ArtifactBaseTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Deploy/ArtifactBaseTests.cs index 82aa79a27f..917b7600b2 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Deploy/ArtifactBaseTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Deploy/ArtifactBaseTests.cs @@ -20,7 +20,7 @@ public class ArtifactBaseTests var serialized = JsonConvert.SerializeObject(artifact); var expected = - "{\"Udi\":\"umb://test/3382d5433b5749d08919bc9961422a1f\",\"Dependencies\":[],\"Name\":\"Test Name\",\"Alias\":\"testAlias\"}"; + "{\"Udi\":\"umb://test/3382d5433b5749d08919bc9961422a1f\",\"Dependencies\":[],\"Checksum\":\"test checksum value\",\"Name\":\"Test Name\",\"Alias\":\"testAlias\"}"; Assert.AreEqual(expected, serialized); }