diff --git a/src/Umbraco.Core/ContentVariationExtensions.cs b/src/Umbraco.Abstractions/ContentVariationExtensions.cs
similarity index 98%
rename from src/Umbraco.Core/ContentVariationExtensions.cs
rename to src/Umbraco.Abstractions/ContentVariationExtensions.cs
index bdcf300f3f..f3e8943172 100644
--- a/src/Umbraco.Core/ContentVariationExtensions.cs
+++ b/src/Umbraco.Abstractions/ContentVariationExtensions.cs
@@ -44,7 +44,7 @@ namespace Umbraco.Core
///
/// Determines whether the property type is invariant.
///
- public static bool VariesByNothing(this PropertyType propertyType) => propertyType.Variations.VariesByNothing();
+ public static bool VariesByNothing(this IPropertyType propertyType) => propertyType.Variations.VariesByNothing();
///
/// Determines whether the property type varies by culture.
diff --git a/src/Umbraco.Core/Models/ContentBase.cs b/src/Umbraco.Abstractions/Models/ContentBase.cs
similarity index 98%
rename from src/Umbraco.Core/Models/ContentBase.cs
rename to src/Umbraco.Abstractions/Models/ContentBase.cs
index e5adddad72..59693efe53 100644
--- a/src/Umbraco.Core/Models/ContentBase.cs
+++ b/src/Umbraco.Abstractions/Models/ContentBase.cs
@@ -44,7 +44,7 @@ namespace Umbraco.Core.Models
///
/// Initializes a new instance of the class.
///
- protected ContentBase(string name, int parentId, IContentTypeComposition contentType, PropertyCollection properties, string culture = null)
+ protected ContentBase(string name, int parentId, IContentTypeComposition contentType, IPropertyCollection properties, string culture = null)
: this(name, contentType, properties, culture)
{
if (parentId == 0) throw new ArgumentOutOfRangeException(nameof(parentId));
@@ -54,14 +54,14 @@ namespace Umbraco.Core.Models
///
/// Initializes a new instance of the class.
///
- protected ContentBase(string name, IContentBase parent, IContentTypeComposition contentType, PropertyCollection properties, string culture = null)
+ protected ContentBase(string name, IContentBase parent, IContentTypeComposition contentType, IPropertyCollection properties, string culture = null)
: this(name, contentType, properties, culture)
{
if (parent == null) throw new ArgumentNullException(nameof(parent));
SetParent(parent);
}
- private ContentBase(string name, IContentTypeComposition contentType, PropertyCollection properties, string culture = null)
+ private ContentBase(string name, IContentTypeComposition contentType, IPropertyCollection properties, string culture = null)
{
ContentType = contentType?.ToSimple() ?? throw new ArgumentNullException(nameof(contentType));
@@ -84,7 +84,7 @@ namespace Umbraco.Core.Models
[IgnoreDataMember]
public ISimpleContentType ContentType { get; private set; }
- internal void ChangeContentType(ISimpleContentType contentType)
+ public void ChangeContentType(ISimpleContentType contentType)
{
ContentType = contentType;
ContentTypeId = contentType.Id;
diff --git a/src/Umbraco.Abstractions/Models/ContentExtensions.cs b/src/Umbraco.Abstractions/Models/ContentExtensions.cs
new file mode 100644
index 0000000000..5fd5e576b8
--- /dev/null
+++ b/src/Umbraco.Abstractions/Models/ContentExtensions.cs
@@ -0,0 +1,19 @@
+using System.Linq;
+
+namespace Umbraco.Core.Models
+{
+ public static class ContentExtensions
+ {
+ public static bool IsAnyUserPropertyDirty(this IContentBase entity)
+ {
+ return entity.Properties.Any(x => x.IsDirty());
+ }
+
+ public static bool WasAnyUserPropertyDirty(this IContentBase entity)
+ {
+ return entity.Properties.Any(x => x.WasDirty());
+ }
+
+
+ }
+}
diff --git a/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs b/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs
new file mode 100644
index 0000000000..8bc41e1190
--- /dev/null
+++ b/src/Umbraco.Abstractions/Models/ContentRepositoryExtensions.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Linq;
+using Umbraco.Core.Exceptions;
+
+namespace Umbraco.Core.Models
+{
+ public static class ContentRepositoryExtensions
+ {
+ public static void SetCultureInfo(this IContentBase content, string culture, string name, DateTime date)
+ {
+ if (name.IsNullOrWhiteSpace())
+ throw new ArgumentNullOrEmptyException(nameof(name));
+
+ if (culture.IsNullOrWhiteSpace())
+ throw new ArgumentNullOrEmptyException(nameof(culture));
+
+ content.CultureInfos.AddOrUpdate(culture, name, date);
+ }
+
+ ///
+ /// Updates a culture date, if the culture exists.
+ ///
+ public static void TouchCulture(this IContentBase content, string culture)
+ {
+ if (culture.IsNullOrWhiteSpace()) return;
+ if (!content.CultureInfos.TryGetValue(culture, out var infos)) return;
+ content.CultureInfos.AddOrUpdate(culture, infos.Name, DateTime.Now);
+ }
+
+ ///
+ /// Used to synchronize all culture dates to the same date if they've been modified
+ ///
+ ///
+ ///
+ ///
+ /// This is so that in an operation where (for example) 2 languages are updates like french and english, it is possible that
+ /// these dates assigned to them differ by a couple of Ticks, but we need to ensure they are persisted at the exact same time.
+ ///
+ public static void AdjustDates(this IContent content, DateTime date)
+ {
+ foreach (var culture in content.PublishedCultures.ToList())
+ {
+ if (!content.PublishCultureInfos.TryGetValue(culture, out var publishInfos))
+ continue;
+
+ // if it's not dirty, it means it hasn't changed so there's nothing to adjust
+ if (!publishInfos.IsDirty())
+ continue;
+
+ content.PublishCultureInfos.AddOrUpdate(culture, publishInfos.Name, date);
+
+ if (content.CultureInfos.TryGetValue(culture, out var infos))
+ SetCultureInfo(content, culture, infos.Name, date);
+ }
+ }
+ }
+
+}
diff --git a/src/Umbraco.Core/Models/SimpleContentType.cs b/src/Umbraco.Abstractions/Models/SimpleContentType.cs
similarity index 100%
rename from src/Umbraco.Core/Models/SimpleContentType.cs
rename to src/Umbraco.Abstractions/Models/SimpleContentType.cs
diff --git a/src/Umbraco.Core/PublishedModelFactoryExtensions.cs b/src/Umbraco.Abstractions/PublishedModelFactoryExtensions.cs
similarity index 100%
rename from src/Umbraco.Core/PublishedModelFactoryExtensions.cs
rename to src/Umbraco.Abstractions/PublishedModelFactoryExtensions.cs
diff --git a/src/Umbraco.Core/ContentExtensions.cs b/src/Umbraco.Core/ContentExtensions.cs
index 07fc2757ea..f9d06b70a3 100644
--- a/src/Umbraco.Core/ContentExtensions.cs
+++ b/src/Umbraco.Core/ContentExtensions.cs
@@ -328,15 +328,7 @@ namespace Umbraco.Core
return entity.Properties.Where(x => x.IsDirty()).Select(x => x.Alias);
}
- public static bool IsAnyUserPropertyDirty(this IContentBase entity)
- {
- return entity.Properties.Any(x => x.IsDirty());
- }
- public static bool WasAnyUserPropertyDirty(this IContentBase entity)
- {
- return entity.Properties.Any(x => x.WasDirty());
- }
#endregion
}
diff --git a/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs b/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
index f9efc60142..db557e1905 100644
--- a/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
+++ b/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs
@@ -88,7 +88,7 @@ namespace Umbraco.Core.Models
{
content.CultureInfos.Clear();
content.CultureInfos = null;
- }
+ }
if (culture == null || culture == "*")
content.Name = other.Name;
@@ -112,32 +112,7 @@ namespace Umbraco.Core.Models
content.PublishCultureInfos.AddOrUpdate(culture, name, date);
}
- ///
- /// Used to synchronize all culture dates to the same date if they've been modified
- ///
- ///
- ///
- ///
- /// This is so that in an operation where (for example) 2 languages are updates like french and english, it is possible that
- /// these dates assigned to them differ by a couple of Ticks, but we need to ensure they are persisted at the exact same time.
- ///
- public static void AdjustDates(this IContent content, DateTime date)
- {
- foreach (var culture in content.PublishedCultures.ToList())
- {
- if (!content.PublishCultureInfos.TryGetValue(culture, out var publishInfos))
- continue;
- // if it's not dirty, it means it hasn't changed so there's nothing to adjust
- if (!publishInfos.IsDirty())
- continue;
-
- content.PublishCultureInfos.AddOrUpdate(culture, publishInfos.Name, date);
-
- if (content.CultureInfos.TryGetValue(culture, out var infos))
- SetCultureInfo(content, culture, infos.Name, date);
- }
- }
// sets the edited cultures on the content
public static void SetCultureEdited(this IContent content, IEnumerable cultures)
@@ -151,17 +126,6 @@ namespace Umbraco.Core.Models
}
}
- public static void SetCultureInfo(this IContentBase content, string culture, string name, DateTime date)
- {
- if (name.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(name));
-
- if (culture.IsNullOrWhiteSpace())
- throw new ArgumentNullOrEmptyException(nameof(culture));
-
- content.CultureInfos.AddOrUpdate(culture, name, date);
- }
-
///
/// Sets the publishing values for names and properties.
///
@@ -249,7 +213,7 @@ namespace Umbraco.Core.Models
// one single culture
keepProcessing = content.ClearPublishInfo(culture);
}
-
+
if (keepProcessing)
{
@@ -288,14 +252,6 @@ namespace Umbraco.Core.Models
return removed;
}
- ///
- /// Updates a culture date, if the culture exists.
- ///
- public static void TouchCulture(this IContentBase content, string culture)
- {
- if (culture.IsNullOrWhiteSpace()) return;
- if (!content.CultureInfos.TryGetValue(culture, out var infos)) return;
- content.CultureInfos.AddOrUpdate(culture, infos.Name, DateTime.Now);
- }
+
}
}
diff --git a/src/Umbraco.Core/Models/Media.cs b/src/Umbraco.Core/Models/Media.cs
index 002611c09c..452bb615d1 100644
--- a/src/Umbraco.Core/Models/Media.cs
+++ b/src/Umbraco.Core/Models/Media.cs
@@ -27,7 +27,7 @@ namespace Umbraco.Core.Models
/// Parent object
/// MediaType for the current Media object
/// Collection of properties
- public Media(string name, IMedia parent, IMediaType contentType, PropertyCollection properties)
+ public Media(string name, IMedia parent, IMediaType contentType, IPropertyCollection properties)
: base(name, parent, contentType, properties)
{ }
@@ -48,7 +48,7 @@ namespace Umbraco.Core.Models
/// Id of the Parent IMedia
/// MediaType for the current Media object
/// Collection of properties
- public Media(string name, int parentId, IMediaType contentType, PropertyCollection properties)
+ public Media(string name, int parentId, IMediaType contentType, IPropertyCollection properties)
: base(name, parentId, contentType, properties)
{ }
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 61a657732d..10dc253789 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -203,6 +203,7 @@
+
@@ -222,7 +223,6 @@
-
@@ -234,7 +234,7 @@
-
+
@@ -250,7 +250,6 @@
-
@@ -315,7 +314,6 @@
-
@@ -405,7 +403,6 @@
-
@@ -414,7 +411,6 @@
-