diff --git a/src/Umbraco.Core/Models/ContentType.cs b/src/Umbraco.Core/Models/ContentType.cs
index df2a7bc1ef..46bf9bdc18 100644
--- a/src/Umbraco.Core/Models/ContentType.cs
+++ b/src/Umbraco.Core/Models/ContentType.cs
@@ -120,67 +120,7 @@ namespace Umbraco.Core.Models
return result;
}
-
- ///
- /// Indicates whether a specific property on the current entity is dirty.
- ///
- /// Name of the property to check
- /// True if Property is dirty, otherwise False
- public override bool IsPropertyDirty(string propertyName)
- {
- bool existsInEntity = base.IsPropertyDirty(propertyName);
-
- bool anyDirtyGroups = PropertyGroups.Any(x => x.IsPropertyDirty(propertyName));
- bool anyDirtyTypes = PropertyTypes.Any(x => x.IsPropertyDirty(propertyName));
-
- return existsInEntity || anyDirtyGroups || anyDirtyTypes;
- }
-
- ///
- /// Indicates whether the current entity is dirty.
- ///
- /// True if entity is dirty, otherwise False
- public override bool IsDirty()
- {
- bool dirtyEntity = base.IsDirty();
-
- bool dirtyGroups = PropertyGroups.Any(x => x.IsDirty());
- bool dirtyTypes = PropertyTypes.Any(x => x.IsDirty());
-
- return dirtyEntity || dirtyGroups || dirtyTypes;
- }
-
- ///
- /// Resets dirty properties by clearing the dictionary used to track changes.
- ///
- ///
- /// Please note that resetting the dirty properties could potentially
- /// obstruct the saving of a new or updated entity.
- ///
- public override void ResetDirtyProperties()
- {
- base.ResetDirtyProperties();
-
- //loop through each property group to reset the property types
- var propertiesReset = new List();
-
- foreach (var propertyGroup in PropertyGroups)
- {
- propertyGroup.ResetDirtyProperties();
- foreach (var propertyType in propertyGroup.PropertyTypes)
- {
- propertyType.ResetDirtyProperties();
- propertiesReset.Add(propertyType.Id);
- }
- }
- //then loop through our property type collection since some might not exist on a property group
- //but don't re-reset ones we've already done.
- foreach (var propertyType in PropertyTypes.Where(x => propertiesReset.Contains(x.Id) == false))
- {
- propertyType.ResetDirtyProperties();
- }
- }
-
+
///
/// Creates a clone of the current entity
///
diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs
index dc5d9c7898..e8d2effbc1 100644
--- a/src/Umbraco.Core/Models/ContentTypeBase.cs
+++ b/src/Umbraco.Core/Models/ContentTypeBase.cs
@@ -503,5 +503,65 @@ namespace Umbraco.Core.Models
{
get { return _propertyTypes; }
}
+
+ ///
+ /// Indicates whether a specific property on the current entity is dirty.
+ ///
+ /// Name of the property to check
+ /// True if Property is dirty, otherwise False
+ public override bool IsPropertyDirty(string propertyName)
+ {
+ bool existsInEntity = base.IsPropertyDirty(propertyName);
+
+ bool anyDirtyGroups = PropertyGroups.Any(x => x.IsPropertyDirty(propertyName));
+ bool anyDirtyTypes = PropertyTypes.Any(x => x.IsPropertyDirty(propertyName));
+
+ return existsInEntity || anyDirtyGroups || anyDirtyTypes;
+ }
+
+ ///
+ /// Indicates whether the current entity is dirty.
+ ///
+ /// True if entity is dirty, otherwise False
+ public override bool IsDirty()
+ {
+ bool dirtyEntity = base.IsDirty();
+
+ bool dirtyGroups = PropertyGroups.Any(x => x.IsDirty());
+ bool dirtyTypes = PropertyTypes.Any(x => x.IsDirty());
+
+ return dirtyEntity || dirtyGroups || dirtyTypes;
+ }
+
+ ///
+ /// Resets dirty properties by clearing the dictionary used to track changes.
+ ///
+ ///
+ /// Please note that resetting the dirty properties could potentially
+ /// obstruct the saving of a new or updated entity.
+ ///
+ public override void ResetDirtyProperties()
+ {
+ base.ResetDirtyProperties();
+
+ //loop through each property group to reset the property types
+ var propertiesReset = new List();
+
+ foreach (var propertyGroup in PropertyGroups)
+ {
+ propertyGroup.ResetDirtyProperties();
+ foreach (var propertyType in propertyGroup.PropertyTypes)
+ {
+ propertyType.ResetDirtyProperties();
+ propertiesReset.Add(propertyType.Id);
+ }
+ }
+ //then loop through our property type collection since some might not exist on a property group
+ //but don't re-reset ones we've already done.
+ foreach (var propertyType in PropertyTypes.Where(x => propertiesReset.Contains(x.Id) == false))
+ {
+ propertyType.ResetDirtyProperties();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
index a099b3c5a2..e5c782c00d 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
@@ -212,18 +212,17 @@ namespace Umbraco.Tests.Persistence.Repositories
{
var contentType = repository.Get(1046);
- // Act
- var contentType2 = repository.Get(1046);
- contentType2.PropertyGroups["Meta"].PropertyTypes.Remove("metaDescription");
- repository.AddOrUpdate(contentType2);
+ // Act
+ contentType.PropertyGroups["Meta"].PropertyTypes.Remove("metaDescription");
+ repository.AddOrUpdate(contentType);
unitOfWork.Commit();
- var contentType3 = repository.Get(1046);
+ var result = repository.Get(1046);
// Assert
- Assert.That(contentType3.PropertyTypes.Any(x => x.Alias == "metaDescription"), Is.False);
- Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(contentType3.PropertyGroups.Count));
- Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(contentType3.PropertyTypes.Count()));
+ Assert.That(result.PropertyTypes.Any(x => x.Alias == "metaDescription"), Is.False);
+ Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(result.PropertyGroups.Count));
+ Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(result.PropertyTypes.Count()));
}
}
diff --git a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs
index 7c794d6f58..acb96da490 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs
@@ -206,8 +206,8 @@ namespace Umbraco.Tests.Persistence.Repositories
// Assert
Assert.That(mediaTypeV3.PropertyTypes.Any(x => x.Alias == "title"), Is.False);
- Assert.That(mediaType.PropertyGroups.Count, Is.EqualTo(mediaTypeV3.PropertyGroups.Count));
- Assert.That(mediaType.PropertyTypes.Count(), Is.EqualTo(mediaTypeV3.PropertyTypes.Count()));
+ Assert.That(mediaTypeV2.PropertyGroups.Count, Is.EqualTo(mediaTypeV3.PropertyGroups.Count));
+ Assert.That(mediaTypeV2.PropertyTypes.Count(), Is.EqualTo(mediaTypeV3.PropertyTypes.Count()));
}
}
diff --git a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs
index 25d16963d2..1f8cd7d582 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs
@@ -24,14 +24,14 @@ namespace Umbraco.Tests.Persistence.Repositories
}
[Test]
- public void Can_Instantiate_Repository_From_Resolver()
+ public void Can_Instantiate_Repository()
{
// Arrange
var provider = new FileUnitOfWorkProvider();
var unitOfWork = provider.GetUnitOfWork();
// Act
- var repository = RepositoryResolver.Current.ResolveByType(unitOfWork);
+ var repository = new ScriptRepository(unitOfWork, _fileSystem);
// Assert
Assert.That(repository, Is.Not.Null);
diff --git a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs
index d518bddd0e..0b37761329 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs
@@ -24,14 +24,15 @@ namespace Umbraco.Tests.Persistence.Repositories
}
[Test]
- public void Can_Instantiate_Repository_From_Resolver()
+ public void Can_Instantiate_Repository()
{
// Arrange
var provider = new FileUnitOfWorkProvider();
var unitOfWork = provider.GetUnitOfWork();
// Act
- var repository = RepositoryResolver.Current.ResolveByType(unitOfWork);
+ var repository = new StylesheetRepository(unitOfWork, _fileSystem);
+
// Assert
Assert.That(repository, Is.Not.Null);