Created
October 5, 2021 21:26
-
-
Save KevinJump/a7fb152f6432b4f2f33492008d4b02ee to your computer and use it in GitHub Desktop.
Sample of how to replace the content serializer in uSync with something that doesn't serialize certain properties. (would need testing)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Umbraco.Core; | |
using Umbraco.Core.Composing; | |
using Umbraco.Core.Logging; | |
using Umbraco.Core.Models; | |
using Umbraco.Core.Services; | |
using uSync8.ContentEdition.Mapping; | |
using uSync8.Core; | |
using uSync8.Core.Serialization; | |
namespace uSync8.ContentEdition.Serializers | |
{ | |
[ComposeAfter(typeof(uSync8.ContentEdition.uSyncContentComposer))] | |
public class CustomContentComposer : IUserComposer | |
{ | |
public void Compose(Composition composition) | |
{ | |
composition.Register<ISyncSerializer<IContent>, CustomContentPropertySerializer>(); | |
} | |
} | |
[SyncSerializer("", "contentPropertySerializer", uSyncConstants.Serialization.Content)] | |
public class CustomContentPropertySerializer : ContentSerializer | |
{ | |
public CustomContentPropertySerializer(IEntityService entityService, ILocalizationService localizationService, IRelationService relationService, ILogger logger, IContentService contentService, IFileService fileService, SyncValueMapperCollection syncMappers) | |
: base(entityService, localizationService, relationService, logger, contentService, fileService, syncMappers) | |
{ | |
this.dontSerialize = new string[] { "myPayPalPropertyAlias" }; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment