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); }