diff --git a/src/Umbraco.Abstractions/Models/IProperty.cs b/src/Umbraco.Abstractions/Models/IProperty.cs
index 308f4ae851..cd8a07393e 100644
--- a/src/Umbraco.Abstractions/Models/IProperty.cs
+++ b/src/Umbraco.Abstractions/Models/IProperty.cs
@@ -6,6 +6,8 @@ namespace Umbraco.Core.Models
{
public interface IProperty
{
+
+ ValueStorageType ValueStorageType { get; }
///
/// Returns the PropertyType, which this Property is based on
///
@@ -96,5 +98,9 @@ namespace Umbraco.Core.Models
/// Enables change tracking.
///
void EnableChangeTracking();
+
+ int PropertyTypeId { get; }
+ void PublishValues(string culture = "*", string segment = "*");
+ void UnpublishValues(string culture = "*", string segment = "*");
}
}
diff --git a/src/Umbraco.Core/Services/ILocalizationService.cs b/src/Umbraco.Abstractions/Services/ILocalizationService.cs
similarity index 99%
rename from src/Umbraco.Core/Services/ILocalizationService.cs
rename to src/Umbraco.Abstractions/Services/ILocalizationService.cs
index 019e07493a..6566f983df 100644
--- a/src/Umbraco.Core/Services/ILocalizationService.cs
+++ b/src/Umbraco.Abstractions/Services/ILocalizationService.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Services
/// Adds or updates a translation for a dictionary item and language
///
///
- ///
+ ///
///
void AddOrUpdateDictionaryValue(IDictionaryItem item, ILanguage language, string value);
diff --git a/src/Umbraco.Core/ContentExtensions.cs b/src/Umbraco.Core/ContentExtensions.cs
index 8e404402d0..6732fd9394 100644
--- a/src/Umbraco.Core/ContentExtensions.cs
+++ b/src/Umbraco.Core/ContentExtensions.cs
@@ -108,7 +108,7 @@ namespace Umbraco.Core
///
///
///
- public static IEnumerable GetNonGroupedProperties(this IContentBase content)
+ public static IEnumerable GetNonGroupedProperties(this IContentBase content)
{
return content.Properties
.Where(x => x.PropertyType.PropertyGroupId == null)
@@ -121,7 +121,7 @@ namespace Umbraco.Core
///
///
///
- public static IEnumerable GetPropertiesForGroup(this IContentBase content, PropertyGroup propertyGroup)
+ public static IEnumerable GetPropertiesForGroup(this IContentBase content, PropertyGroup propertyGroup)
{
//get the properties for the current tab
return content.Properties
@@ -178,7 +178,7 @@ namespace Umbraco.Core
}
// gets or creates a property for a content item.
- private static Property GetProperty(IContentBase content, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, string propertyTypeAlias)
+ private static IProperty GetProperty(IContentBase content, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, string propertyTypeAlias)
{
var property = content.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(propertyTypeAlias));
if (property != null) return property;
diff --git a/src/Umbraco.Core/Models/ContentBase.cs b/src/Umbraco.Core/Models/ContentBase.cs
index fbb68194b7..c87cb0a370 100644
--- a/src/Umbraco.Core/Models/ContentBase.cs
+++ b/src/Umbraco.Core/Models/ContentBase.cs
@@ -20,7 +20,7 @@ namespace Umbraco.Core.Models
{
private int _contentTypeId;
private int _writerId;
- private PropertyCollection _properties;
+ private IPropertyCollection _properties;
private ContentCultureInfosCollection _cultureInfos;
internal IReadOnlyList AllPropertyTypes { get; }
@@ -135,7 +135,7 @@ namespace Umbraco.Core.Models
///
[DataMember]
[DoNotClone]
- public PropertyCollection Properties
+ public IPropertyCollection Properties
{
get => _properties;
set
@@ -490,7 +490,7 @@ namespace Umbraco.Core.Models
if (clonedContent._properties != null)
{
clonedContent._properties.CollectionChanged -= PropertiesChanged; //clear this event handler if any
- clonedContent._properties = (PropertyCollection)_properties.DeepClone(); //manually deep clone
+ clonedContent._properties = (IPropertyCollection)_properties.DeepClone(); //manually deep clone
clonedContent._properties.CollectionChanged += clonedContent.PropertiesChanged; //re-assign correct event handler
}
diff --git a/src/Umbraco.Core/Models/ContentTagsExtensions.cs b/src/Umbraco.Core/Models/ContentTagsExtensions.cs
index dd7a716520..7f9c012722 100644
--- a/src/Umbraco.Core/Models/ContentTagsExtensions.cs
+++ b/src/Umbraco.Core/Models/ContentTagsExtensions.cs
@@ -34,7 +34,7 @@ namespace Umbraco.Core.Models
}
// gets and validates the property
- private static Property GetTagProperty(this IContentBase content, string propertyTypeAlias)
+ private static IProperty GetTagProperty(this IContentBase content, string propertyTypeAlias)
{
if (content == null) throw new ArgumentNullException(nameof(content));
diff --git a/src/Umbraco.Core/Models/IContentBase.cs b/src/Umbraco.Core/Models/IContentBase.cs
index 0f660181fb..1864996379 100644
--- a/src/Umbraco.Core/Models/IContentBase.cs
+++ b/src/Umbraco.Core/Models/IContentBase.cs
@@ -98,7 +98,7 @@ namespace Umbraco.Core.Models
/// List of properties, which make up all the data available for this Content object
///
/// Properties are loaded as part of the Content object graph
- PropertyCollection Properties { get; set; }
+ IPropertyCollection Properties { get; set; }
///
/// Gets a value indicating whether the content entity has a property with the supplied alias.
diff --git a/src/Umbraco.Core/Models/IPropertyCollection.cs b/src/Umbraco.Core/Models/IPropertyCollection.cs
new file mode 100644
index 0000000000..e5bd4f60fd
--- /dev/null
+++ b/src/Umbraco.Core/Models/IPropertyCollection.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using System.Collections.Specialized;
+
+namespace Umbraco.Core.Models
+{
+ public interface IPropertyCollection : IEnumerable
+ {
+ bool TryGetValue(string propertyTypeAlias, out IProperty property);
+ bool Contains(string key);
+
+ event NotifyCollectionChangedEventHandler CollectionChanged;
+
+ void EnsurePropertyTypes(IEnumerable propertyTypes);
+ void EnsureCleanPropertyTypes(IEnumerable propertyTypes);
+ object DeepClone();
+
+ IProperty this[string name] { get; }
+ IProperty this[int index] { get; }
+ void Add(IProperty property);
+
+ int Count { get; }
+ }
+}
diff --git a/src/Umbraco.Core/Models/Property.cs b/src/Umbraco.Core/Models/Property.cs
index 9b2cda67c1..9aa9ab4d74 100644
--- a/src/Umbraco.Core/Models/Property.cs
+++ b/src/Umbraco.Core/Models/Property.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Core.Models
///
/// Initializes a new instance of the class.
///
- public Property(PropertyType propertyType)
+ public Property(IPropertyType propertyType)
{
PropertyType = propertyType;
}
@@ -41,7 +41,7 @@ namespace Umbraco.Core.Models
///
/// Initializes a new instance of the class.
///
- public Property(int id, PropertyType propertyType)
+ public Property(int id, IPropertyType propertyType)
{
Id = id;
PropertyType = propertyType;
@@ -152,7 +152,7 @@ namespace Umbraco.Core.Models
/// Returns the Id of the PropertyType, which this Property is based on
///
[IgnoreDataMember]
- internal int PropertyTypeId => PropertyType.Id;
+ public int PropertyTypeId => PropertyType.Id;
///
/// Returns the DatabaseType that the underlaying DataType is using to store its values
@@ -161,7 +161,7 @@ namespace Umbraco.Core.Models
/// Only used internally when saving the property value.
///
[IgnoreDataMember]
- internal ValueStorageType ValueStorageType => PropertyType.ValueStorageType;
+ public ValueStorageType ValueStorageType => PropertyType.ValueStorageType;
///
/// Gets the value.
@@ -191,7 +191,7 @@ namespace Umbraco.Core.Models
// internal - must be invoked by the content item
// does *not* validate the value - content item must validate first
- internal void PublishValues(string culture = "*", string segment = "*")
+ public void PublishValues(string culture = "*", string segment = "*")
{
culture = culture.NullOrWhiteSpaceAsNull();
segment = segment.NullOrWhiteSpaceAsNull();
@@ -216,7 +216,7 @@ namespace Umbraco.Core.Models
}
// internal - must be invoked by the content item
- internal void UnpublishValues(string culture = "*", string segment = "*")
+ public void UnpublishValues(string culture = "*", string segment = "*")
{
culture = culture.NullOrWhiteSpaceAsNull();
segment = segment.NullOrWhiteSpaceAsNull();
diff --git a/src/Umbraco.Core/Models/PropertyCollection.cs b/src/Umbraco.Core/Models/PropertyCollection.cs
index c587a45424..2415be4dce 100644
--- a/src/Umbraco.Core/Models/PropertyCollection.cs
+++ b/src/Umbraco.Core/Models/PropertyCollection.cs
@@ -12,10 +12,10 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
- public class PropertyCollection : KeyedCollection, INotifyCollectionChanged, IDeepCloneable
+ public class PropertyCollection : KeyedCollection, INotifyCollectionChanged, IDeepCloneable, IPropertyCollection
{
private readonly object _addLocker = new object();
-
+
internal Func AdditionValidator { get; set; }
///
@@ -60,7 +60,7 @@ namespace Umbraco.Core.Models
///
/// Replaces the property at the specified index with the specified property.
///
- protected override void SetItem(int index, Property property)
+ protected override void SetItem(int index, IProperty property)
{
var oldItem = index >= 0 ? this[index] : property;
base.SetItem(index, property);
@@ -80,7 +80,7 @@ namespace Umbraco.Core.Models
///
/// Inserts the specified property at the specified index.
///
- protected override void InsertItem(int index, Property property)
+ protected override void InsertItem(int index, IProperty property)
{
base.InsertItem(index, property);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, property));
@@ -98,7 +98,7 @@ namespace Umbraco.Core.Models
///
/// Adds or updates a property.
///
- internal new void Add(Property property)
+ public new void Add(IProperty property)
{
lock (_addLocker) // TODO: why are we locking here and not everywhere else?!
{
@@ -141,7 +141,7 @@ namespace Umbraco.Core.Models
return -1;
}
- protected override string GetKeyForItem(Property item)
+ protected override string GetKeyForItem(IProperty item)
{
return item.Alias;
}
@@ -149,7 +149,7 @@ namespace Umbraco.Core.Models
///
/// Gets the property with the specified PropertyType.
///
- internal Property this[PropertyType propertyType]
+ internal IProperty this[IPropertyType propertyType]
{
get
{
@@ -157,7 +157,7 @@ namespace Umbraco.Core.Models
}
}
- public bool TryGetValue(string propertyTypeAlias, out Property property)
+ public bool TryGetValue(string propertyTypeAlias, out IProperty property)
{
property = this.FirstOrDefault(x => x.Alias.InvariantEquals(propertyTypeAlias));
return property != null;
@@ -176,7 +176,7 @@ namespace Umbraco.Core.Models
///
/// Ensures that the collection contains properties for the specified property types.
///
- protected internal void EnsurePropertyTypes(IEnumerable propertyTypes)
+ public void EnsurePropertyTypes(IEnumerable propertyTypes)
{
if (propertyTypes == null)
return;
@@ -188,7 +188,7 @@ namespace Umbraco.Core.Models
///
/// Ensures that the collection does not contain properties not in the specified property types.
///
- protected internal void EnsureCleanPropertyTypes(IEnumerable propertyTypes)
+ public void EnsureCleanPropertyTypes(IEnumerable propertyTypes)
{
if (propertyTypes == null)
return;
diff --git a/src/Umbraco.Core/Models/PropertyTagsExtensions.cs b/src/Umbraco.Core/Models/PropertyTagsExtensions.cs
index 63cf870221..1bac5c98f1 100644
--- a/src/Umbraco.Core/Models/PropertyTagsExtensions.cs
+++ b/src/Umbraco.Core/Models/PropertyTagsExtensions.cs
@@ -20,7 +20,7 @@ namespace Umbraco.Core.Models
// gets the tag configuration for a property
// from the datatype configuration, and the editor tag configuration attribute
- internal static TagConfiguration GetTagConfiguration(this Property property)
+ internal static TagConfiguration GetTagConfiguration(this IProperty property)
{
if (property == null) throw new ArgumentNullException(nameof(property));
@@ -44,7 +44,7 @@ namespace Umbraco.Core.Models
/// The tags.
/// A value indicating whether to merge the tags with existing tags instead of replacing them.
/// A culture, for multi-lingual properties.
- public static void AssignTags(this Property property, IEnumerable tags, bool merge = false, string culture = null)
+ public static void AssignTags(this IProperty property, IEnumerable tags, bool merge = false, string culture = null)
{
if (property == null) throw new ArgumentNullException(nameof(property));
@@ -56,7 +56,7 @@ namespace Umbraco.Core.Models
}
// assumes that parameters are consistent with the datatype configuration
- private static void AssignTags(this Property property, IEnumerable tags, bool merge, TagsStorageType storageType, char delimiter, string culture)
+ private static void AssignTags(this IProperty property, IEnumerable tags, bool merge, TagsStorageType storageType, char delimiter, string culture)
{
// set the property value
var trimmedTags = tags.Select(x => x.Trim()).ToArray();
@@ -97,7 +97,7 @@ namespace Umbraco.Core.Models
/// The property.
/// The tags.
/// A culture, for multi-lingual properties.
- public static void RemoveTags(this Property property, IEnumerable tags, string culture = null)
+ public static void RemoveTags(this IProperty property, IEnumerable tags, string culture = null)
{
if (property == null) throw new ArgumentNullException(nameof(property));
@@ -109,7 +109,7 @@ namespace Umbraco.Core.Models
}
// assumes that parameters are consistent with the datatype configuration
- private static void RemoveTags(this Property property, IEnumerable tags, TagsStorageType storageType, char delimiter, string culture)
+ private static void RemoveTags(this IProperty property, IEnumerable tags, TagsStorageType storageType, char delimiter, string culture)
{
// already empty = nothing to do
var value = property.GetValue(culture)?.ToString();
@@ -131,7 +131,7 @@ namespace Umbraco.Core.Models
}
// used by ContentRepositoryBase
- internal static IEnumerable GetTagsValue(this Property property, string culture = null)
+ internal static IEnumerable GetTagsValue(this IProperty property, string culture = null)
{
if (property == null) throw new ArgumentNullException(nameof(property));
@@ -142,7 +142,7 @@ namespace Umbraco.Core.Models
return property.GetTagsValue(configuration.StorageType, configuration.Delimiter, culture);
}
- private static IEnumerable GetTagsValue(this Property property, TagsStorageType storageType, char delimiter, string culture = null)
+ private static IEnumerable GetTagsValue(this IProperty property, TagsStorageType storageType, char delimiter, string culture = null)
{
if (property == null) throw new ArgumentNullException(nameof(property));
@@ -182,7 +182,7 @@ namespace Umbraco.Core.Models
/// This is used both by the content repositories to initialize a property with some tag values, and by the
/// content controllers to update a property with values received from the property editor.
///
- internal static void SetTagsValue(this Property property, object value, TagConfiguration tagConfiguration, string culture)
+ internal static void SetTagsValue(this IProperty property, object value, TagConfiguration tagConfiguration, string culture)
{
if (property == null) throw new ArgumentNullException(nameof(property));
if (tagConfiguration == null) throw new ArgumentNullException(nameof(tagConfiguration));
@@ -195,7 +195,7 @@ namespace Umbraco.Core.Models
// assumes that parameters are consistent with the datatype configuration
// value can be an enumeration of string, or a serialized value using storageType format
- private static void SetTagsValue(Property property, object value, TagsStorageType storageType, char delimiter, string culture)
+ private static void SetTagsValue(IProperty property, object value, TagsStorageType storageType, char delimiter, string culture)
{
if (value == null) value = Enumerable.Empty();
diff --git a/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs b/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs
index 9d9482fedb..fc31f61763 100644
--- a/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs
+++ b/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs
@@ -46,7 +46,7 @@ namespace Umbraco.Core.Persistence.Factories
return properties;
}
- private static PropertyDataDto BuildDto(int versionId, Property property, int? languageId, string segment, object value)
+ private static PropertyDataDto BuildDto(int versionId, IProperty property, int? languageId, string segment, object value)
{
var dto = new PropertyDataDto { VersionId = versionId, PropertyTypeId = property.PropertyTypeId };
@@ -109,7 +109,7 @@ namespace Umbraco.Core.Persistence.Factories
/// The value of this will be used to populate the edited cultures in the umbracoDocumentCultureVariation table.
///
///
- public static IEnumerable BuildDtos(ContentVariation contentVariation, int currentVersionId, int publishedVersionId, IEnumerable properties,
+ public static IEnumerable BuildDtos(ContentVariation contentVariation, int currentVersionId, int publishedVersionId, IEnumerable properties,
ILanguageRepository languageRepository, out bool edited,
out HashSet editedCultures)
{
diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs
index 5a43738230..2fa75e2f3f 100644
--- a/src/Umbraco.Core/Services/Implement/ContentService.cs
+++ b/src/Umbraco.Core/Services/Implement/ContentService.cs
@@ -1402,7 +1402,7 @@ namespace Umbraco.Core.Services.Implement
if (d.Trashed) continue; // won't publish
//publish the culture values and validate the property values, if validation fails, log the invalid properties so the develeper has an idea of what has failed
- Property[] invalidProperties = null;
+ IProperty[] invalidProperties = null;
var impact = CultureImpact.Explicit(culture, IsDefaultCulture(allLangs, culture));
var tryPublish = d.PublishCulture(impact) && _propertyValidationService.Value.IsPropertyDataValid(d, out invalidProperties, impact);
if (invalidProperties != null && invalidProperties.Length > 0)
@@ -2602,7 +2602,7 @@ namespace Umbraco.Core.Services.Implement
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content);
//validate the property values
- Property[] invalidProperties = null;
+ IProperty[] invalidProperties = null;
if (!impactsToPublish.All(x => _propertyValidationService.Value.IsPropertyDataValid(content, out invalidProperties, x)))
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content)
{
diff --git a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
index bc21da15a7..f115dacc6c 100644
--- a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
+++ b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
@@ -77,7 +77,7 @@ namespace Umbraco.Core.Services.Implement
var children = _contentService.GetPagedChildren(content.Id, page++, pageSize, out total);
SerializeChildren(children, xml, published);
}
-
+
}
return xml;
@@ -552,7 +552,7 @@ namespace Umbraco.Core.Services.Implement
}
// exports a property as XElements.
- private IEnumerable SerializeProperty(Property property, bool published)
+ private IEnumerable SerializeProperty(IProperty property, bool published)
{
var propertyType = property.PropertyType;
diff --git a/src/Umbraco.Core/Services/PropertyValidationService.cs b/src/Umbraco.Core/Services/PropertyValidationService.cs
index f619e5f47e..1704d52206 100644
--- a/src/Umbraco.Core/Services/PropertyValidationService.cs
+++ b/src/Umbraco.Core/Services/PropertyValidationService.cs
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Services
///
/// Validates the content item's properties pass validation rules
///
- public bool IsPropertyDataValid(IContent content, out Property[] invalidProperties, CultureImpact impact)
+ public bool IsPropertyDataValid(IContent content, out IProperty[] invalidProperties, CultureImpact impact)
{
// select invalid properties
invalidProperties = content.Properties.Where(x =>
@@ -66,7 +66,7 @@ namespace Umbraco.Core.Services
///
/// Gets a value indicating whether the property has valid values.
///
- public bool IsPropertyValid(Property property, string culture = "*", string segment = "*")
+ public bool IsPropertyValid(IProperty property, string culture = "*", string segment = "*")
{
//NOTE - the pvalue and vvalues logic in here is borrowed directly from the Property.Values setter so if you are wondering what that's all about, look there.
// The underlying Property._pvalue and Property._vvalues are not exposed but we can re-create these values ourselves which is what it's doing.
diff --git a/src/Umbraco.Core/Services/PublishResult.cs b/src/Umbraco.Core/Services/PublishResult.cs
index 4f1ff776a2..fe11d77cf3 100644
--- a/src/Umbraco.Core/Services/PublishResult.cs
+++ b/src/Umbraco.Core/Services/PublishResult.cs
@@ -32,6 +32,6 @@ namespace Umbraco.Core.Services
///
/// Gets or sets the invalid properties, if the status failed due to validation.
///
- public IEnumerable InvalidProperties { get; set; }
+ public IEnumerable InvalidProperties { get; set; }
}
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 3241a3852c..8df0c336db 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -241,6 +241,7 @@
+
diff --git a/src/Umbraco.Examine/BaseValueSetBuilder.cs b/src/Umbraco.Examine/BaseValueSetBuilder.cs
index 93cee88231..4a306aa5ff 100644
--- a/src/Umbraco.Examine/BaseValueSetBuilder.cs
+++ b/src/Umbraco.Examine/BaseValueSetBuilder.cs
@@ -24,7 +24,7 @@ namespace Umbraco.Examine
///
public abstract IEnumerable GetValueSets(params TContent[] content);
- protected void AddPropertyValue(Property property, string culture, string segment, IDictionary> values)
+ protected void AddPropertyValue(IProperty property, string culture, string segment, IDictionary> values)
{
var editor = _propertyEditors[property.PropertyType.PropertyEditorAlias];
if (editor == null) return;
@@ -61,7 +61,7 @@ namespace Umbraco.Examine
else
values.Add($"{keyVal.Key}{cultureSuffix}", val.Yield());
}
-
+
break;
}
}
diff --git a/src/Umbraco.Tests/Mapping/MappingTests.cs b/src/Umbraco.Tests/Mapping/MappingTests.cs
index e6a382692c..ad336168c6 100644
--- a/src/Umbraco.Tests/Mapping/MappingTests.cs
+++ b/src/Umbraco.Tests/Mapping/MappingTests.cs
@@ -285,10 +285,10 @@ namespace Umbraco.Tests.Mapping
{
public void DefineMaps(UmbracoMapper mapper)
{
- mapper.Define((source, context) => new ContentPropertyDto(), Map);
+ mapper.Define((source, context) => new ContentPropertyDto(), Map);
}
- private static void Map(Property source, ContentPropertyDto target, MapperContext context)
+ private static void Map(IProperty source, ContentPropertyDto target, MapperContext context)
{ }
}
diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs
index 6a4054d5ae..996f02e16a 100644
--- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs
+++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs
@@ -261,7 +261,7 @@ namespace Umbraco.Tests.Models.Mapping
#region Assertions
- private void AssertDisplayProperty(IContentProperties result, Property p)
+ private void AssertDisplayProperty(IContentProperties result, IProperty p)
where T : ContentPropertyBasic
{
var pDto = result.Properties.SingleOrDefault(x => x.Alias == p.Alias);
@@ -325,7 +325,7 @@ namespace Umbraco.Tests.Models.Mapping
Assert.AreEqual(content.Properties.Count(), result.Properties.Count(x => x.Alias.StartsWith("_umb_") == false));
}
- private void AssertBasicProperty(IContentProperties result, Property p)
+ private void AssertBasicProperty(IContentProperties result, IProperty p)
where T : ContentPropertyBasic
{
var pDto = result.Properties.SingleOrDefault(x => x.Alias == p.Alias);
@@ -341,7 +341,7 @@ namespace Umbraco.Tests.Models.Mapping
Assert.AreEqual(pDto.Value, p.GetValue().ToString());
}
- private void AssertProperty(IContentProperties result, Property p)
+ private void AssertProperty(IContentProperties result, IProperty p)
{
AssertBasicProperty(result, p);
diff --git a/src/Umbraco.Tests/Views/web.config b/src/Umbraco.Tests/Views/web.config
new file mode 100644
index 0000000000..efd80424e5
--- /dev/null
+++ b/src/Umbraco.Tests/Views/web.config
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs
index 5c8e6fc2b5..11cc59a464 100644
--- a/src/Umbraco.Web/Editors/ContentController.cs
+++ b/src/Umbraco.Web/Editors/ContentController.cs
@@ -1837,7 +1837,7 @@ namespace Umbraco.Web.Editors
private void MapValuesForPersistence(ContentItemSave contentSave)
{
// inline method to determine if a property type varies
- bool Varies(Property property) => property.PropertyType.VariesByCulture();
+ bool Varies(IProperty property) => property.PropertyType.VariesByCulture();
var variantIndex = 0;
diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs
index 300c777b3a..83167eb9ae 100644
--- a/src/Umbraco.Web/Editors/ContentControllerBase.cs
+++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs
@@ -50,8 +50,8 @@ namespace Umbraco.Web.Editors
internal void MapPropertyValuesForPersistence(
TSaved contentItem,
ContentPropertyCollectionDto dto,
- Func getPropertyValue,
- Action savePropertyValue,
+ Func getPropertyValue,
+ Action savePropertyValue,
string culture)
where TPersisted : IContentBase
where TSaved : IContentSave
diff --git a/src/Umbraco.Web/Editors/Filters/ContentModelValidator.cs b/src/Umbraco.Web/Editors/Filters/ContentModelValidator.cs
index 4acf0c948e..14531227e1 100644
--- a/src/Umbraco.Web/Editors/Filters/ContentModelValidator.cs
+++ b/src/Umbraco.Web/Editors/Filters/ContentModelValidator.cs
@@ -46,7 +46,7 @@ namespace Umbraco.Web.Editors.Filters
protected ContentModelValidator(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor) : base(logger, umbracoContextAccessor)
{
}
-
+
///
/// Ensure the content exists
///
@@ -85,7 +85,7 @@ namespace Umbraco.Web.Editors.Filters
///
///
///
- protected bool ValidateProperties(List postedProperties, List persistedProperties, HttpActionContext actionContext)
+ protected bool ValidateProperties(List postedProperties, List persistedProperties, HttpActionContext actionContext)
{
foreach (var p in postedProperties)
{
@@ -142,7 +142,7 @@ namespace Umbraco.Web.Editors.Filters
var postedValue = postedProp.Value;
ValidatePropertyValue(model, modelWithProperties, editor, p, postedValue, modelState);
-
+
}
return modelState.IsValid;
diff --git a/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs b/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
index 41f0e2fb65..cab20926ff 100644
--- a/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
+++ b/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
@@ -147,7 +147,7 @@ namespace Umbraco.Web.Macros
_content = content;
}
- public PagePublishedProperty(IPublishedPropertyType propertyType, IPublishedContent content, Umbraco.Core.Models.Property property)
+ public PagePublishedProperty(IPublishedPropertyType propertyType, IPublishedContent content, IProperty property)
: base(propertyType, PropertyCacheLevel.Unknown) // cache level is ignored
{
_sourceValue = property.GetValue();
diff --git a/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs
index dc0df4ca96..d3b4353f2f 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs
@@ -64,7 +64,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll
private static void Map(IContent source, ContentPropertyCollectionDto target, MapperContext context)
{
- target.Properties = context.MapEnumerable(source.Properties);
+ target.Properties = context.MapEnumerable(source.Properties);
}
// Umbraco.Code.MapAll -AllowPreview -Errors -PersistedContent
@@ -99,7 +99,7 @@ namespace Umbraco.Web.Models.Mapping
target.Variants = _contentVariantMapper.Map(source, context);
target.ContentDto = new ContentPropertyCollectionDto();
- target.ContentDto.Properties = context.MapEnumerable(source.Properties);
+ target.ContentDto.Properties = context.MapEnumerable(source.Properties);
}
// Umbraco.Code.MapAll -Segment -Language
@@ -129,7 +129,7 @@ namespace Umbraco.Web.Models.Mapping
target.Owner = _commonMapper.GetOwner(source, context);
target.ParentId = source.ParentId;
target.Path = source.Path;
- target.Properties = context.MapEnumerable(source.Properties);
+ target.Properties = context.MapEnumerable(source.Properties);
target.SortOrder = source.SortOrder;
target.State = _basicStateMapper.Map(source, context);
target.Trashed = source.Trashed;
diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs
index 36c1b360b2..4e49f2ea2a 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Web.Models.Mapping
/// Assigns the PropertyEditor, Id, Alias and Value to the property
///
///
- public virtual void Map(Property property, TDestination dest, MapperContext context)
+ public virtual void Map(IProperty property, TDestination dest, MapperContext context)
{
var editor = _propertyEditors[property.PropertyType.PropertyEditorAlias];
if (editor == null)
diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs
index f68c5d8b44..12278e97ea 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Web.Models.Mapping
{
_textService = textService;
}
- public override void Map(Property originalProp, ContentPropertyDisplay dest, MapperContext context)
+ public override void Map(IProperty originalProp, ContentPropertyDisplay dest, MapperContext context)
{
base.Map(originalProp, dest, context);
diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDtoMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyDtoMapper.cs
index 72107c6201..f481ad445c 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentPropertyDtoMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyDtoMapper.cs
@@ -16,7 +16,7 @@ namespace Umbraco.Web.Models.Mapping
: base(dataTypeService, entityService, logger, propertyEditors)
{ }
- public override void Map(Property property, ContentPropertyDto dest, MapperContext context)
+ public override void Map(IProperty property, ContentPropertyDto dest, MapperContext context)
{
base.Map(property, dest, context);
diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs
index e6290cc19e..5d659fbf9e 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs
@@ -27,9 +27,9 @@ namespace Umbraco.Web.Models.Mapping
public void DefineMaps(UmbracoMapper mapper)
{
mapper.Define>((source, context) => new Tab(), Map);
- mapper.Define((source, context) => new ContentPropertyBasic(), Map);
- mapper.Define((source, context) => new ContentPropertyDto(), Map);
- mapper.Define((source, context) => new ContentPropertyDisplay(), Map);
+ mapper.Define((source, context) => new ContentPropertyBasic(), Map);
+ mapper.Define((source, context) => new ContentPropertyDto(), Map);
+ mapper.Define((source, context) => new ContentPropertyDisplay(), Map);
}
// Umbraco.Code.MapAll -Properties -Alias -Expanded
@@ -40,19 +40,19 @@ namespace Umbraco.Web.Models.Mapping
target.Label = source.Name;
}
- private void Map(Property source, ContentPropertyBasic target, MapperContext context)
+ private void Map(IProperty source, ContentPropertyBasic target, MapperContext context)
{
// assume this is mapping everything and no MapAll is required
_contentPropertyBasicConverter.Map(source, target, context);
}
- private void Map(Property source, ContentPropertyDto target, MapperContext context)
+ private void Map(IProperty source, ContentPropertyDto target, MapperContext context)
{
// assume this is mapping everything and no MapAll is required
_contentPropertyDtoConverter.Map(source, target, context);
}
- private void Map(Property source, ContentPropertyDisplay target, MapperContext context)
+ private void Map(IProperty source, ContentPropertyDisplay target, MapperContext context)
{
// assume this is mapping everything and no MapAll is required
_contentPropertyDisplayMapper.Map(source, target, context);
diff --git a/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs
index 05c006ec41..80bdc7ade4 100644
--- a/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs
@@ -42,7 +42,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll
private static void Map(IMedia source, ContentPropertyCollectionDto target, MapperContext context)
{
- target.Properties = context.MapEnumerable(source.Properties);
+ target.Properties = context.MapEnumerable(source.Properties);
}
// Umbraco.Code.MapAll -Properties -Errors -Edited -Updater -Alias -IsContainer
@@ -86,7 +86,7 @@ namespace Umbraco.Web.Models.Mapping
target.Owner = _commonMapper.GetOwner(source, context);
target.ParentId = source.ParentId;
target.Path = source.Path;
- target.Properties = context.MapEnumerable(source.Properties);
+ target.Properties = context.MapEnumerable(source.Properties);
target.SortOrder = source.SortOrder;
target.State = null;
target.Trashed = source.Trashed;
diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
index 8671bfe538..fd295803c1 100644
--- a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
@@ -113,7 +113,7 @@ namespace Umbraco.Web.Models.Mapping
target.Owner = _commonMapper.GetOwner(source, context);
target.ParentId = source.ParentId;
target.Path = source.Path;
- target.Properties = context.MapEnumerable(source.Properties);
+ target.Properties = context.MapEnumerable(source.Properties);
target.SortOrder = source.SortOrder;
target.State = null;
target.Udi = Udi.Create(Constants.UdiEntityType.Member, source.Key);
@@ -151,7 +151,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll
private static void Map(IMember source, ContentPropertyCollectionDto target, MapperContext context)
{
- target.Properties = context.MapEnumerable(source.Properties);
+ target.Properties = context.MapEnumerable(source.Properties);
}
private MembershipScenario GetMembershipScenario()
diff --git a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs
index 8744b068a7..81d75de498 100644
--- a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs
@@ -176,7 +176,7 @@ namespace Umbraco.Web.Models.Mapping
///
///
///
- protected override List MapProperties(IContentBase content, List properties, MapperContext context)
+ protected override List MapProperties(IContentBase content, List properties, MapperContext context)
{
var result = base.MapProperties(content, properties, context);
var member = (IMember)content;
diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs
index b8d76572fb..70a001735a 100644
--- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs
@@ -103,9 +103,9 @@ namespace Umbraco.Web.Models.Mapping
///
///
///
- protected virtual List MapProperties(IContentBase content, List properties, MapperContext context)
+ protected virtual List MapProperties(IContentBase content, List properties, MapperContext context)
{
- return context.MapEnumerable(properties.OrderBy(x => x.PropertyType.SortOrder));
+ return context.MapEnumerable(properties.OrderBy(x => x.PropertyType.SortOrder));
}
}
@@ -132,7 +132,7 @@ namespace Umbraco.Web.Models.Mapping
var groupsGroupsByName = contentType.CompositionPropertyGroups.OrderBy(x => x.SortOrder).GroupBy(x => x.Name);
foreach (var groupsByName in groupsGroupsByName)
{
- var properties = new List();
+ var properties = new List();
// merge properties for groups with the same name
foreach (var group in groupsByName)
diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
index a3396a5fb3..849ad443c8 100644
--- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
@@ -48,7 +48,7 @@ namespace Umbraco.Web.PropertyEditors
///
/// The property.
/// A value indicating whether a property is an upload field, and (optionally) has a non-empty value.
- private static bool IsUploadField(Property property)
+ private static bool IsUploadField(IProperty property)
{
return property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.Aliases.UploadField;
}
@@ -70,7 +70,7 @@ namespace Umbraco.Web.PropertyEditors
///
///
///
- private IEnumerable GetFilePathsFromPropertyValues(Property prop)
+ private IEnumerable GetFilePathsFromPropertyValues(IProperty prop)
{
var propVals = prop.Values;
foreach (var propertyValue in propVals)
diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
index 1d7c1eef65..d120210411 100644
--- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
@@ -65,7 +65,7 @@ namespace Umbraco.Web.PropertyEditors
///
/// The property.
/// A value indicating whether a property is an image cropper field, and (optionally) has a non-empty value.
- private static bool IsCropperField(Property property)
+ private static bool IsCropperField(IProperty property)
{
return property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.Aliases.ImageCropper;
}
@@ -111,7 +111,7 @@ namespace Umbraco.Web.PropertyEditors
///
///
///
- private IEnumerable GetFilePathsFromPropertyValues(Property prop)
+ private IEnumerable GetFilePathsFromPropertyValues(IProperty prop)
{
//parses out the src from a json string
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
index bf4975714d..6d34a2af42 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
@@ -4,6 +4,7 @@ using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Exceptions;
+using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Composing;
using Umbraco.Web.Models;