diff --git a/src/Umbraco.Core/Deploy/ArtifactDependency.cs b/src/Umbraco.Core/Deploy/ArtifactDependency.cs index 07ba917dc2..31c8025ddb 100644 --- a/src/Umbraco.Core/Deploy/ArtifactDependency.cs +++ b/src/Umbraco.Core/Deploy/ArtifactDependency.cs @@ -1,42 +1,64 @@ +using System.Text.Json.Serialization; + namespace Umbraco.Cms.Core.Deploy; /// -/// Represents an artifact dependency. +/// Represents an artifact dependency. /// /// -/// Dependencies have an order property which indicates whether it must be respected when ordering artifacts. -/// -/// Dependencies have a mode which can be Match or Exist depending on whether the checksum should -/// match. -/// +/// +/// Dependencies have an order property which indicates whether it must be respected when ordering artifacts. +/// +/// +/// Dependencies have a mode which can be or depending on whether the checksum should match. +/// /// public class ArtifactDependency { /// - /// Initializes a new instance of the ArtifactDependency class with an entity identifier and a mode. + /// Initializes a new instance of the class. /// - /// The entity identifier of the artifact that is a dependency. + /// The entity identifier of the artifact dependency. /// A value indicating whether the dependency is ordering. /// The dependency mode. - public ArtifactDependency(Udi udi, bool ordering, ArtifactDependencyMode mode) + /// The checksum. + public ArtifactDependency(Udi udi, bool ordering, ArtifactDependencyMode mode, string? checksum = null) { Udi = udi; Ordering = ordering; Mode = mode; + Checksum = checksum; } /// - /// Gets the entity id of the artifact that is a dependency. + /// Gets the entity identifier of the artifact dependency. /// + /// + /// The entity identifier of the artifact dependency. + /// public Udi Udi { get; } /// - /// Gets a value indicating whether the dependency is ordering. + /// Gets a value indicating whether the dependency is ordering. /// + /// + /// true if the dependency is ordering; otherwise, false. + /// public bool Ordering { get; } /// - /// Gets the dependency mode. + /// Gets the dependency mode. /// + /// + /// The dependency mode. + /// public ArtifactDependencyMode Mode { get; } + + /// + /// Gets the checksum. + /// + /// + /// The checksum. + /// + public string? Checksum { get; } } diff --git a/src/Umbraco.Core/Deploy/DataTypeConfigurationConnectorExtensions.cs b/src/Umbraco.Core/Deploy/DataTypeConfigurationConnectorExtensions.cs deleted file mode 100644 index dbd501d277..0000000000 --- a/src/Umbraco.Core/Deploy/DataTypeConfigurationConnectorExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Umbraco.Cms.Core.Models; - -namespace Umbraco.Cms.Core.Deploy; - -/// -/// Extension methods adding backwards-compatability between and . -/// -/// -/// These extension methods will be removed in Umbraco 13. -/// -public static class DataTypeConfigurationConnectorExtensions -{ - /// - /// Gets the artifact configuration value corresponding to a data type configuration and gather dependencies. - /// - /// The connector. - /// The data type. - /// The dependencies. - /// The context cache. - /// - /// The artifact configuration value. - /// - /// - /// This extension method tries to make use of the on types also implementing . - /// - public static string? ToArtifact(this IDataTypeConfigurationConnector connector, IDataType dataType, ICollection dependencies, IContextCache contextCache) - => connector is IDataTypeConfigurationConnector2 connector2 - ? connector2.ToArtifact(dataType, dependencies, contextCache) - : connector.ToArtifact(dataType, dependencies); - - /// - /// Gets the data type configuration corresponding to an artifact configuration value. - /// - /// The connector. - /// The data type. - /// The artifact configuration value. - /// The context cache. - /// - /// The data type configuration. - /// - /// - /// This extension method tries to make use of the on types also implementing . - /// - public static object? FromArtifact(this IDataTypeConfigurationConnector connector, IDataType dataType, string? configuration, IContextCache contextCache) - => connector is IDataTypeConfigurationConnector2 connector2 - ? connector2.FromArtifact(dataType, configuration, contextCache) - : connector.FromArtifact(dataType, configuration); -} diff --git a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs index 36302efd07..4cb0690d1f 100644 --- a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs +++ b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs @@ -24,20 +24,20 @@ public interface IDataTypeConfigurationConnector /// /// The data type. /// The dependencies. + /// The context cache. /// /// The artifact configuration value. /// - [Obsolete($"Implement {nameof(IDataTypeConfigurationConnector2)} and use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - string? ToArtifact(IDataType dataType, ICollection dependencies); + string? ToArtifact(IDataType dataType, ICollection dependencies, IContextCache contextCache); /// /// Gets the data type configuration corresponding to an artifact configuration value. /// /// The data type. /// The artifact configuration value. + /// The context cache. /// /// The data type configuration. /// - [Obsolete($"Implement {nameof(IDataTypeConfigurationConnector2)} and use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - object? FromArtifact(IDataType dataType, string? configuration); + object? FromArtifact(IDataType dataType, string? configuration, IContextCache contextCache); } diff --git a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector2.cs b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector2.cs deleted file mode 100644 index 772bc35dc4..0000000000 --- a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector2.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Umbraco.Cms.Core.Models; - -namespace Umbraco.Cms.Core.Deploy; - -/// -/// -/// This interface will be merged back into and removed in Umbraco 13. -/// -public interface IDataTypeConfigurationConnector2 : IDataTypeConfigurationConnector -{ - /// - /// Gets the artifact configuration value corresponding to a data type configuration and gather dependencies. - /// - /// The data type. - /// The dependencies. - /// - /// The artifact configuration value. - /// - [Obsolete($"Use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - string? IDataTypeConfigurationConnector.ToArtifact(IDataType dataType, ICollection dependencies) - => ToArtifact(dataType, dependencies, PassThroughCache.Instance); - - /// - /// Gets the artifact configuration value corresponding to a data type configuration and gather dependencies. - /// - /// The data type. - /// The dependencies. - /// The context cache. - /// - /// The artifact configuration value. - /// - string? ToArtifact(IDataType dataType, ICollection dependencies, IContextCache contextCache); - - /// - /// Gets the data type configuration corresponding to an artifact configuration value. - /// - /// The data type. - /// The artifact configuration value. - /// - /// The data type configuration. - /// - [Obsolete($"Use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - object? IDataTypeConfigurationConnector.FromArtifact(IDataType dataType, string? configuration) - => FromArtifact(dataType, configuration, PassThroughCache.Instance); - - /// - /// Gets the data type configuration corresponding to an artifact configuration value. - /// - /// The data type. - /// The artifact configuration value. - /// The context cache. - /// - /// The data type configuration. - /// - object? FromArtifact(IDataType dataType, string? configuration, IContextCache contextCache); -} diff --git a/src/Umbraco.Core/Deploy/IServiceConnector.cs b/src/Umbraco.Core/Deploy/IServiceConnector.cs index adf4c57502..84617943c6 100644 --- a/src/Umbraco.Core/Deploy/IServiceConnector.cs +++ b/src/Umbraco.Core/Deploy/IServiceConnector.cs @@ -12,21 +12,21 @@ public interface IServiceConnector : IDiscoverable /// Gets an artifact. /// /// The entity identifier of the artifact. + /// The context cache. /// /// The corresponding artifact, or null. /// - [Obsolete($"Implement {nameof(IServiceConnector2)} and use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - IArtifact? GetArtifact(Udi udi); + IArtifact? GetArtifact(Udi udi, IContextCache contextCache); /// /// Gets an artifact. /// /// The entity. + /// The context cache. /// /// The corresponding artifact. /// - [Obsolete($"Implement {nameof(IServiceConnector2)} and use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - IArtifact GetArtifact(object entity); + IArtifact GetArtifact(object entity, IContextCache contextCache); /// /// Initializes processing for an artifact. @@ -47,10 +47,10 @@ public interface IServiceConnector : IDiscoverable void Process(ArtifactDeployState dart, IDeployContext context, int pass); /// - /// Explodes a range into udis. + /// Explodes a range into UDIs. /// /// The range. - /// The list of udis where to add the new udis. + /// The list of UDIs where to add the new UDIs. /// /// Also, it's cool to have a method named Explode. Kaboom! /// @@ -78,9 +78,9 @@ public interface IServiceConnector : IDiscoverable /// /// This is temporary. At least we thought it would be, in sept. 2016. What day is it now? /// - /// At the moment our UI has a hard time returning proper udis, mainly because Core's tree do - /// not manage guids but only ints... so we have to provide a way to support it. The string id here - /// can be either a real string (for string udis) or an "integer as a string", using the value "-1" to + /// At the moment our UI has a hard time returning proper UDIs, mainly because Core's tree do + /// not manage GUIDs but only integers... so we have to provide a way to support it. The string id here + /// can be either a real string (for string UDIs) or an "integer as a string", using the value "-1" to /// indicate the "root" i.e. an open udi. /// /// diff --git a/src/Umbraco.Core/Deploy/IServiceConnector2.cs b/src/Umbraco.Core/Deploy/IServiceConnector2.cs deleted file mode 100644 index 6c1558a956..0000000000 --- a/src/Umbraco.Core/Deploy/IServiceConnector2.cs +++ /dev/null @@ -1,38 +0,0 @@ -namespace Umbraco.Cms.Core.Deploy; - -/// -/// -/// This interface will be merged back into and removed in Umbraco 13. -/// -public interface IServiceConnector2 : IServiceConnector -{ - /// - [Obsolete($"Use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - IArtifact? IServiceConnector.GetArtifact(Udi udi) - => GetArtifact(udi, PassThroughCache.Instance); - - /// - /// Gets an artifact. - /// - /// The entity identifier of the artifact. - /// The context cache. - /// - /// The corresponding artifact, or null. - /// - IArtifact? GetArtifact(Udi udi, IContextCache contextCache); - - /// - [Obsolete($"Use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - IArtifact IServiceConnector.GetArtifact(object entity) - => GetArtifact(entity, PassThroughCache.Instance); - - /// - /// Gets an artifact. - /// - /// The entity. - /// The context cache. - /// - /// The corresponding artifact. - /// - IArtifact GetArtifact(object entity, IContextCache contextCache); -} diff --git a/src/Umbraco.Core/Deploy/IValueConnector.cs b/src/Umbraco.Core/Deploy/IValueConnector.cs index fe28e41017..5e5e2da1a4 100644 --- a/src/Umbraco.Core/Deploy/IValueConnector.cs +++ b/src/Umbraco.Core/Deploy/IValueConnector.cs @@ -26,11 +26,11 @@ public interface IValueConnector /// The content property value. /// The value property type /// The content dependencies. + /// The context cache. /// /// The deploy property value. /// - [Obsolete($"Implement {nameof(IValueConnector2)} and use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - string? ToArtifact(object? value, IPropertyType propertyType, ICollection dependencies); + string? ToArtifact(object? value, IPropertyType propertyType, ICollection dependencies, IContextCache contextCache); /// /// Gets the content property value corresponding to a deploy property value. @@ -38,9 +38,9 @@ public interface IValueConnector /// The deploy property value. /// The value property type /// The current content property value. + /// The context cache. /// /// The content property value. /// - [Obsolete($"Implement {nameof(IValueConnector2)} and use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - object? FromArtifact(string? value, IPropertyType propertyType, object? currentValue); + object? FromArtifact(string? value, IPropertyType propertyType, object? currentValue, IContextCache contextCache); } diff --git a/src/Umbraco.Core/Deploy/IValueConnector2.cs b/src/Umbraco.Core/Deploy/IValueConnector2.cs deleted file mode 100644 index a0c99dca06..0000000000 --- a/src/Umbraco.Core/Deploy/IValueConnector2.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Umbraco.Cms.Core.Models; - -namespace Umbraco.Cms.Core.Deploy; - -/// -/// -/// This interface will be merged back into and removed in Umbraco 13. -/// -public interface IValueConnector2 : IValueConnector -{ - /// - [Obsolete($"Use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - string? IValueConnector.ToArtifact(object? value, IPropertyType propertyType, ICollection dependencies) - => ToArtifact(value, propertyType, dependencies, PassThroughCache.Instance); - - /// - /// Gets the deploy property value corresponding to a content property value, and gather dependencies. - /// - /// The content property value. - /// The value property type - /// The content dependencies. - /// The context cache. - /// - /// The deploy property value. - /// - string? ToArtifact(object? value, IPropertyType propertyType, ICollection dependencies, IContextCache contextCache); - - /// - [Obsolete($"Use the overload accepting {nameof(IContextCache)} instead. This overload will be removed in Umbraco 13.")] - object? IValueConnector.FromArtifact(string? value, IPropertyType propertyType, object? currentValue) - => FromArtifact(value, propertyType, currentValue, PassThroughCache.Instance); - - /// - /// Gets the content property value corresponding to a deploy property value. - /// - /// The deploy property value. - /// The value property type - /// The current content property value. - /// The context cache. - /// - /// The content property value. - /// - object? FromArtifact(string? value, IPropertyType propertyType, object? currentValue, IContextCache contextCache); -} diff --git a/src/Umbraco.Core/Deploy/ServiceConnectorExtensions.cs b/src/Umbraco.Core/Deploy/ServiceConnectorExtensions.cs deleted file mode 100644 index 0d0000f97c..0000000000 --- a/src/Umbraco.Core/Deploy/ServiceConnectorExtensions.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace Umbraco.Cms.Core.Deploy; - -/// -/// Extension methods adding backwards-compatability between and . -/// -/// -/// These extension methods will be removed in Umbraco 13. -/// -public static class ServiceConnectorExtensions -{ - /// - /// Gets an artifact. - /// - /// The connector. - /// The entity identifier of the artifact. - /// The context cache. - /// - /// The corresponding artifact, or null. - /// - /// - /// This extension method tries to make use of the on types also implementing . - /// - public static IArtifact? GetArtifact(this IServiceConnector connector, Udi udi, IContextCache contextCache) - => connector is IServiceConnector2 connector2 - ? connector2.GetArtifact(udi, contextCache) - : connector.GetArtifact(udi); - - /// - /// Gets an artifact. - /// - /// The connector. - /// The entity. - /// The context cache. - /// - /// The corresponding artifact. - /// - /// - /// This extension method tries to make use of the on types also implementing . - /// - public static IArtifact GetArtifact(this IServiceConnector connector, object entity, IContextCache contextCache) - => connector is IServiceConnector2 connector2 - ? connector2.GetArtifact(entity, contextCache) - : connector.GetArtifact(entity); -} diff --git a/src/Umbraco.Core/Deploy/ValueConnectorExtensions.cs b/src/Umbraco.Core/Deploy/ValueConnectorExtensions.cs deleted file mode 100644 index eadcee55e0..0000000000 --- a/src/Umbraco.Core/Deploy/ValueConnectorExtensions.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Umbraco.Cms.Core.Models; - -namespace Umbraco.Cms.Core.Deploy; - -/// -/// Extension methods adding backwards-compatability between and . -/// -/// -/// These extension methods will be removed in Umbraco 13. -/// -public static class ValueConnectorExtensions -{ - /// - /// Gets the artifact value corresponding to a property value and gather dependencies. - /// - /// The connector. - /// The property value. - /// The property type. - /// The dependencies. - /// The context cache. - /// - /// The artifact value. - /// - /// - /// This extension method tries to make use of the on types also implementing . - /// - public static string? ToArtifact(this IValueConnector connector, object? value, IPropertyType propertyType, ICollection dependencies, IContextCache contextCache) - => connector is IValueConnector2 connector2 - ? connector2.ToArtifact(value, propertyType, dependencies, contextCache) - : connector.ToArtifact(value, propertyType, dependencies); - - /// - /// Gets the property value corresponding to an artifact value. - /// - /// The connector. - /// The artifact value. - /// The property type. - /// The current property value. - /// The context cache. - /// - /// The property value. - /// - /// - /// This extension method tries to make use of the on types also implementing . - /// - public static object? FromArtifact(this IValueConnector connector, string? value, IPropertyType propertyType, object? currentValue, IContextCache contextCache) - => connector is IValueConnector2 connector2 - ? connector2.FromArtifact(value, propertyType, currentValue, contextCache) - : connector.FromArtifact(value, propertyType, currentValue); -} diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/CoreThings/UdiTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/CoreThings/UdiTests.cs index ccca8f9f3c..30a8d6a1fa 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/CoreThings/UdiTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/CoreThings/UdiTests.cs @@ -326,7 +326,7 @@ public class UdiTests } [UdiDefinition("foo", UdiType.GuidUdi)] - public class FooConnector : IServiceConnector2 + public class FooConnector : IServiceConnector { public IArtifact GetArtifact(Udi udi, IContextCache contextCache) => throw new NotImplementedException();