diff --git a/src/Umbraco.Core/Components/RelateOnCopyComponent.cs b/src/Umbraco.Core/Components/RelateOnCopyComponent.cs
index 4ebd309e9f..5356fa6e30 100644
--- a/src/Umbraco.Core/Components/RelateOnCopyComponent.cs
+++ b/src/Umbraco.Core/Components/RelateOnCopyComponent.cs
@@ -1,10 +1,12 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Models;
+using Umbraco.Core.Persistence.Repositories.Implement;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
namespace Umbraco.Core.Components
{
+
//TODO: This should just exist in the content service/repo!
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public sealed class RelateOnCopyComponent : UmbracoComponentBase, IUmbracoCoreComponent
diff --git a/src/Umbraco.Core/Components/UpdateContentOnVariantChangesComponent.cs b/src/Umbraco.Core/Components/UpdateContentOnVariantChangesComponent.cs
new file mode 100644
index 0000000000..06d2b86166
--- /dev/null
+++ b/src/Umbraco.Core/Components/UpdateContentOnVariantChangesComponent.cs
@@ -0,0 +1,93 @@
+using System;
+using System.Linq;
+using Umbraco.Core.Models;
+using Umbraco.Core.Models.Entities;
+using Umbraco.Core.Services;
+using Umbraco.Core.Services.Changes;
+using Umbraco.Core.Services.Implement;
+
+namespace Umbraco.Core.Components
+{
+ ///
+ /// Manages data changes for when content/property types have variation changes
+ ///
+ [RuntimeLevel(MinLevel = RuntimeLevel.Run)]
+ public sealed class UpdateContentOnVariantChangesComponent : UmbracoComponentBase, IUmbracoCoreComponent
+ {
+ private IContentService _contentService;
+ private ILocalizationService _langService;
+
+ public void Initialize(IContentService contentService, ILocalizationService langService)
+ {
+ _contentService = contentService;
+ _langService = langService;
+ ContentTypeService.ScopedRefreshedEntity += OnContentTypeRefreshedEntity;
+ }
+
+ private void OnContentTypeRefreshedEntity(IContentTypeService sender, ContentTypeChange.EventArgs e)
+ {
+ var defaultLang = _langService.GetDefaultLanguageIsoCode(); //this will be cached
+
+ foreach (var c in e.Changes)
+ {
+ // existing property alias change?
+ var hasAnyPropertyVariationChanged = c.Item.WasPropertyTypeVariationChanged(out var aliases);
+ if (hasAnyPropertyVariationChanged)
+ {
+ var contentOfType = _contentService.GetByType(c.Item.Id);
+
+ foreach (var a in aliases)
+ {
+ var propType = c.Item.PropertyTypes.First(x => x.Alias == a);
+
+ switch(propType.Variations)
+ {
+ case ContentVariation.Culture:
+ //if the current variation is culture it means that the previous was nothing
+ foreach (var content in contentOfType)
+ {
+ object invariantVal;
+ try
+ {
+ content.Properties[a].PropertyType.Variations = ContentVariation.Nothing;
+ //now get the culture val
+ invariantVal = content.GetValue(a);
+ }
+ finally
+ {
+ content.Properties[a].PropertyType.Variations = ContentVariation.Culture;
+ }
+ //set the invariant value
+ content.SetValue(a, invariantVal, defaultLang);
+ }
+ break;
+ case ContentVariation.Nothing:
+ //if the current variation is nothing it means that the previous was culture
+ foreach(var content in contentOfType)
+ {
+ object cultureVal;
+ try
+ {
+ content.Properties[a].PropertyType.Variations = ContentVariation.Culture;
+ //now get the culture val
+ cultureVal = content.GetValue(a, defaultLang);
+ }
+ finally
+ {
+ content.Properties[a].PropertyType.Variations = ContentVariation.Nothing;
+ }
+ //set the invariant value
+ content.SetValue(a, cultureVal);
+ }
+ break;
+ default:
+ throw new NotSupportedException("The variation change is not supported");
+ }
+ }
+
+ _contentService.Save(contentOfType);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs
index 6f90b5201d..7467d83099 100644
--- a/src/Umbraco.Core/Models/ContentTypeBase.cs
+++ b/src/Umbraco.Core/Models/ContentTypeBase.cs
@@ -408,7 +408,8 @@ namespace Umbraco.Core.Models
/// PropertyTypes that are not part of a PropertyGroup
///
[IgnoreDataMember]
- internal PropertyTypeCollection PropertyTypeCollection => _propertyTypes;
+ //fixme should we mark this as EditorBrowsable hidden since it really isn't ever used?
+ internal PropertyTypeCollection PropertyTypeCollection => _propertyTypes;
///
/// Indicates whether a specific property on the current entity is dirty.
diff --git a/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs b/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs
index ef55f0d469..8af48bb881 100644
--- a/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs
+++ b/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs
@@ -1,4 +1,8 @@
-using Umbraco.Core.Models.PublishedContent;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Umbraco.Core.Models.Entities;
+using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.Models
{
@@ -16,5 +20,48 @@ namespace Umbraco.Core.Models
else if (typeof(IMemberType).IsAssignableFrom(type)) itemType = PublishedItemType.Member;
return itemType;
}
+
+ ///
+ /// Used to check if any property type was changed between variant/invariant
+ ///
+ ///
+ ///
+ internal static bool WasPropertyTypeVariationChanged(this IContentTypeBase contentType)
+ {
+ return contentType.WasPropertyTypeVariationChanged(out var _);
+ }
+
+ ///
+ /// Used to check if any property type was changed between variant/invariant
+ ///
+ ///
+ ///
+ internal static bool WasPropertyTypeVariationChanged(this IContentTypeBase contentType, out IReadOnlyCollection aliases)
+ {
+ var a = new List();
+
+ // property variation change?
+ var hasAnyPropertyVariationChanged = contentType.PropertyTypes.Any(propertyType =>
+ {
+ if (!(propertyType is IRememberBeingDirty dirtyProperty))
+ throw new Exception("oops");
+
+ // skip new properties
+ //TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly
+ var isNewProperty = dirtyProperty.WasPropertyDirty("Id");
+ if (isNewProperty) return false;
+
+ // variation change?
+ var dirty = dirtyProperty.WasPropertyDirty("Variations");
+ if (dirty)
+ a.Add(propertyType.Alias);
+
+ return dirty;
+
+ });
+
+ aliases = a;
+ return hasAnyPropertyVariationChanged;
+ }
}
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs
index 6ace73fbc3..c258a76b30 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs
@@ -608,6 +608,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
#region UnitOfWork Events
+ //fixme: The reason these events are in the repository is for legacy, the events should exist at the service
+ // level now since we can fire these events within the transaction... so move the events to service level
+
public class ScopedEntityEventArgs : EventArgs
{
public ScopedEntityEventArgs(IScope scope, TEntity entity)
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs
index 555fc56157..05b9bc8631 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs
@@ -323,9 +323,7 @@ AND umbracoNode.id <> @id",
});
}
- // fixme below, manage the property type
-
- // delete ??? fixme wtf is this?
+ // delete property types
// ... by excepting entries from db with entries from collections
if (entity.IsPropertyDirty("PropertyTypes") || entity.PropertyTypes.Any(x => x.IsDirty()))
{
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs
index ae5d9ae8b8..2026daba74 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs
@@ -30,7 +30,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
return new FullDataSetRepositoryCachePolicy(GlobalIsolatedCache, ScopeAccessor, GetEntityId, /*expires:*/ false);
}
- private FullDataSetRepositoryCachePolicy TypedCachePolicy => (FullDataSetRepositoryCachePolicy) CachePolicy;
+ private FullDataSetRepositoryCachePolicy TypedCachePolicy => CachePolicy as FullDataSetRepositoryCachePolicy;
#region Overrides of RepositoryBase
@@ -215,7 +215,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
public ILanguage GetByIsoCode(string isoCode)
{
- TypedCachePolicy.GetAllCached(PerformGetAll); // ensure cache is populated, in a non-expensive way
+ // ensure cache is populated, in a non-expensive way
+ if (TypedCachePolicy != null)
+ TypedCachePolicy.GetAllCached(PerformGetAll);
+
var id = GetIdByIsoCode(isoCode, throwOnNotFound: false);
return id.HasValue ? Get(id.Value) : null;
}
@@ -228,7 +231,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
if (isoCode == null) return null;
- TypedCachePolicy.GetAllCached(PerformGetAll); // ensure cache is populated, in a non-expensive way
+ // ensure cache is populated, in a non-expensive way
+ if (TypedCachePolicy != null)
+ TypedCachePolicy.GetAllCached(PerformGetAll);
+
lock (_codeIdMap)
{
if (_codeIdMap.TryGetValue(isoCode, out var id)) return id;
@@ -246,7 +252,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
if (id == null) return null;
- TypedCachePolicy.GetAllCached(PerformGetAll); // ensure cache is populated, in a non-expensive way
+ // ensure cache is populated, in a non-expensive way
+ if (TypedCachePolicy != null)
+ TypedCachePolicy.GetAllCached(PerformGetAll);
+
lock (_codeIdMap) // yes, we want to lock _codeIdMap
{
if (_idCodeMap.TryGetValue(id.Value, out var isoCode)) return isoCode;
@@ -269,8 +278,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// do NOT leak that language, it's not deep-cloned!
private ILanguage GetDefault()
{
- // get all cached, non-cloned
- var languages = TypedCachePolicy.GetAllCached(PerformGetAll).ToList();
+ // get all cached
+ var languages = (TypedCachePolicy?.GetAllCached(PerformGetAll) //try to get all cached non-cloned if using the correct cache policy (not the case in unit tests)
+ ?? CachePolicy.GetAll(Array.Empty(), PerformGetAll)).ToList();
+
var language = languages.FirstOrDefault(x => x.IsDefaultVariantLanguage);
if (language != null) return language;
diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTItemTService.cs
index 9fa9a47003..33fb9a0894 100644
--- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTItemTService.cs
+++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTItemTService.cs
@@ -20,12 +20,12 @@ namespace Umbraco.Core.Services.Implement
internal static event TypedEventHandler.EventArgs> Changed;
// that one is always immediate (transactional)
- public static event TypedEventHandler.EventArgs> UowRefreshedEntity;
+ public static event TypedEventHandler.EventArgs> ScopedRefreshedEntity;
// used by tests to clear events
internal static void ClearScopeEvents()
{
- UowRefreshedEntity = null;
+ ScopedRefreshedEntity = null;
}
// these must be dispatched
@@ -48,7 +48,7 @@ namespace Umbraco.Core.Services.Implement
protected void OnUowRefreshedEntity(ContentTypeChange.EventArgs args)
{
// that one is always immediate (not dispatched, transactional)
- UowRefreshedEntity.RaiseEvent(args, This);
+ ScopedRefreshedEntity.RaiseEvent(args, This);
}
protected bool OnSavingCancelled(IScope scope, SaveEventArgs args)
diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
index 8ed0a0f645..a3bc87315b 100644
--- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
+++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
@@ -118,6 +118,8 @@ namespace Umbraco.Core.Services.Implement
// - content type alias changed
// - content type property removed, or alias changed
// - content type composition removed (not testing if composition had properties...)
+ // - content type variation changed
+ // - property type variation changed
//
// because these are the changes that would impact the raw content data
@@ -132,7 +134,8 @@ namespace Umbraco.Core.Services.Implement
var dirty = (IRememberBeingDirty)contentType;
// skip new content types
- var isNewContentType = dirty.WasPropertyDirty("HasIdentity");
+ //TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly
+ var isNewContentType = dirty.WasPropertyDirty("Id");
if (isNewContentType)
{
AddChange(changes, contentType, ContentTypeChangeTypes.Create);
@@ -149,12 +152,12 @@ namespace Umbraco.Core.Services.Implement
throw new Exception("oops");
// skip new properties
- var isNewProperty = dirtyProperty.WasPropertyDirty("HasIdentity");
+ //TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly
+ var isNewProperty = dirtyProperty.WasPropertyDirty("Id");
if (isNewProperty) return false;
// alias change?
- var hasPropertyAliasBeenChanged = dirtyProperty.WasPropertyDirty("Alias");
- return hasPropertyAliasBeenChanged;
+ return dirtyProperty.WasPropertyDirty("Alias");
});
// removed properties?
@@ -163,8 +166,15 @@ namespace Umbraco.Core.Services.Implement
// removed compositions?
var hasAnyCompositionBeenRemoved = dirty.WasPropertyDirty("HasCompositionTypeBeenRemoved");
+ // variation changed?
+ var hasContentTypeVariationChanged = dirty.WasPropertyDirty("Variations");
+
+ // property variation change?
+ var hasAnyPropertyVariationChanged = contentType.WasPropertyTypeVariationChanged();
+
// main impact on properties?
- var hasPropertyMainImpact = hasAnyCompositionBeenRemoved || hasAnyPropertyBeenRemoved || hasAnyPropertyChangedAlias;
+ var hasPropertyMainImpact = hasContentTypeVariationChanged || hasAnyPropertyVariationChanged
+ || hasAnyCompositionBeenRemoved || hasAnyPropertyBeenRemoved || hasAnyPropertyChangedAlias;
if (hasAliasChanged || hasPropertyMainImpact)
{
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 496a66137a..379d5ad48a 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -170,6 +170,7 @@
+
diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
index 31105aa28e..6087279285 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
@@ -63,8 +63,7 @@ namespace Umbraco.Tests.Persistence.Repositories
}
//TODO Add test to verify SetDefaultTemplates updates both AllowedTemplates and DefaultTemplate(id).
-
-
+
[Test]
public void Maps_Templates_Correctly()
{
@@ -377,7 +376,7 @@ namespace Umbraco.Tests.Persistence.Repositories
repository.Save(contentType);
- var dirty = ((ICanBeDirty)contentType).IsDirty();
+ var dirty = contentType.IsDirty();
// Assert
Assert.That(contentType.HasIdentity, Is.True);
diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
similarity index 99%
rename from src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs
rename to src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
index 7ff7c0a2e4..68e29c4efe 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
@@ -25,7 +25,7 @@ namespace Umbraco.Tests.Persistence.Repositories
{
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)]
- public class ContentRepositoryTest : TestWithDatabaseBase
+ public class DocumentRepositoryTest : TestWithDatabaseBase
{
public override void SetUp()
{
diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs
index be07dbdd23..8ece9621ce 100644
--- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs
+++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs
@@ -15,6 +15,7 @@ using Umbraco.Core.Services.Implement;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
using Umbraco.Tests.Testing;
+using Umbraco.Core.Components;
namespace Umbraco.Tests.Services
{
@@ -23,6 +24,54 @@ namespace Umbraco.Tests.Services
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest, PublishedRepositoryEvents = true)]
public class ContentTypeServiceTests : TestWithSomeContentBase
{
+ [Test]
+ public void Change_Property_Type_From_Variant_Invariant()
+ {
+ //initialize the listener which is responsible for updating content based on variant/invariant changes
+ var listener = new UpdateContentOnVariantChangesComponent();
+ listener.Initialize(ServiceContext.ContentService, ServiceContext.LocalizationService);
+
+ //create content type with a property type that varies by culture
+ var contentType = MockedContentTypes.CreateBasicContentType();
+ contentType.Variations = ContentVariation.Culture;
+ var contentCollection = new PropertyTypeCollection(true);
+ contentCollection.Add(new PropertyType("test", ValueStorageType.Ntext)
+ {
+ Alias = "title",
+ Name = "Title",
+ Description = "",
+ Mandatory = false,
+ SortOrder = 1,
+ DataTypeId = -88,
+ Variations = ContentVariation.Culture
+ });
+ contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 });
+ contentType.ResetDirtyProperties(false);
+ ServiceContext.ContentTypeService.Save(contentType);
+
+ //create some content of this content type
+ IContent doc = MockedContent.CreateBasicContent(contentType);
+ doc.SetCultureName("Home", "en-US");
+ doc.SetValue("title", "hello world", "en-US");
+ ServiceContext.ContentService.Save(doc);
+
+ Assert.AreEqual("hello world", doc.GetValue("title", "en-US"));
+
+ //change the property type to be invariant
+ contentType.PropertyTypes.First().Variations = ContentVariation.Nothing;
+ ServiceContext.ContentTypeService.Save(contentType);
+ doc = ServiceContext.ContentService.GetById(doc.Id); //re-get
+
+ Assert.AreEqual("hello world", doc.GetValue("title"));
+
+ //change back property type to be variant
+ contentType.PropertyTypes.First().Variations = ContentVariation.Culture;
+ ServiceContext.ContentTypeService.Save(contentType);
+ doc = ServiceContext.ContentService.GetById(doc.Id); //re-get
+
+ Assert.AreEqual("hello world", doc.GetValue("title", "en-US"));
+ }
+
[Test]
public void Deleting_Media_Type_With_Hierarchy_Of_Media_Items_Moves_Orphaned_Media_To_Recycle_Bin()
{
diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj
index a3f02b2fdc..aac1f0b865 100644
--- a/src/Umbraco.Tests/Umbraco.Tests.csproj
+++ b/src/Umbraco.Tests/Umbraco.Tests.csproj
@@ -123,6 +123,7 @@
+
@@ -393,7 +394,6 @@
-
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
index 8786753e4f..a9903669b9 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
@@ -198,6 +198,9 @@ namespace Umbraco.Web.PublishedCache.NuCache
private void InitializeRepositoryEvents()
{
+ //fixme: The reason these events are in the repository is for legacy, the events should exist at the service
+ // level now since we can fire these events within the transaction... so move the events to service level
+
// plug repository event handlers
// these trigger within the transaction to ensure consistency
// and are used to maintain the central, database-level XML cache
@@ -212,9 +215,9 @@ namespace Umbraco.Web.PublishedCache.NuCache
MemberRepository.ScopedEntityRefresh += OnMemberRefreshedEntity;
// plug
- ContentTypeService.UowRefreshedEntity += OnContentTypeRefreshedEntity;
- MediaTypeService.UowRefreshedEntity += OnMediaTypeRefreshedEntity;
- MemberTypeService.UowRefreshedEntity += OnMemberTypeRefreshedEntity;
+ ContentTypeService.ScopedRefreshedEntity += OnContentTypeRefreshedEntity;
+ MediaTypeService.ScopedRefreshedEntity += OnMediaTypeRefreshedEntity;
+ MemberTypeService.ScopedRefreshedEntity += OnMemberTypeRefreshedEntity;
}
private void TearDownRepositoryEvents()
@@ -229,9 +232,9 @@ namespace Umbraco.Web.PublishedCache.NuCache
//MemberRepository.RemovedVersion -= OnMemberRemovedVersion;
MemberRepository.ScopedEntityRefresh -= OnMemberRefreshedEntity;
- ContentTypeService.UowRefreshedEntity -= OnContentTypeRefreshedEntity;
- MediaTypeService.UowRefreshedEntity -= OnMediaTypeRefreshedEntity;
- MemberTypeService.UowRefreshedEntity -= OnMemberTypeRefreshedEntity;
+ ContentTypeService.ScopedRefreshedEntity -= OnContentTypeRefreshedEntity;
+ MediaTypeService.ScopedRefreshedEntity -= OnMediaTypeRefreshedEntity;
+ MemberTypeService.ScopedRefreshedEntity -= OnMemberTypeRefreshedEntity;
}
public override void Dispose()
diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs
index 5fa89e3f7b..5b816c2f26 100644
--- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs
+++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs
@@ -194,9 +194,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
MemberRepository.ScopedEntityRefresh += OnMemberRefreshedEntity;
// plug
- ContentTypeService.UowRefreshedEntity += OnContentTypeRefreshedEntity;
- MediaTypeService.UowRefreshedEntity += OnMediaTypeRefreshedEntity;
- MemberTypeService.UowRefreshedEntity += OnMemberTypeRefreshedEntity;
+ ContentTypeService.ScopedRefreshedEntity += OnContentTypeRefreshedEntity;
+ MediaTypeService.ScopedRefreshedEntity += OnMediaTypeRefreshedEntity;
+ MemberTypeService.ScopedRefreshedEntity += OnMemberTypeRefreshedEntity;
_withRepositoryEvents = true;
}
@@ -213,9 +213,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
MemberRepository.ScopeVersionRemove -= OnMemberRemovingVersion;
MemberRepository.ScopedEntityRefresh -= OnMemberRefreshedEntity;
- ContentTypeService.UowRefreshedEntity -= OnContentTypeRefreshedEntity;
- MediaTypeService.UowRefreshedEntity -= OnMediaTypeRefreshedEntity;
- MemberTypeService.UowRefreshedEntity -= OnMemberTypeRefreshedEntity;
+ ContentTypeService.ScopedRefreshedEntity -= OnContentTypeRefreshedEntity;
+ MediaTypeService.ScopedRefreshedEntity -= OnMediaTypeRefreshedEntity;
+ MemberTypeService.ScopedRefreshedEntity -= OnMemberTypeRefreshedEntity;
_withRepositoryEvents = false;
}