Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marian 2 posts 72 karma points
    Sep 10, 2020 @ 14:56
    Marian
    0

    Hello,

    I want configure uSync Complete to skip property values of a content and synchronize just a content tree. Is there any way to do that?

    Thanks

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Sep 10, 2020 @ 16:22
    Kevin Jump
    0

    Hi,

    You can't do it in config, but you could feasibly do that in code.

    if you wrote your own ContentHandler and ContentSerializer that inherit from the existing contentHandler and contentSerializer then you would only have to override the derserializeProperties method in the serializer to stop the properties from being saved into the content.

    Then you could alter the uSync8.config file to use your own custom content handler and it would not sync the properties.

    update: So your inhertited versions would be almost empty classes with constructors and the serializer would have a DeserializeProperties method that returned an empty list.

    So i think this would do it:

    override protected Attempt<List<uSyncChange>, string> DeserializeProperties(TObject item, XElement node, SyncSerializerOptions options)
    {
       return Attempt.Succeed(Enumerable.Empty<uSyncChange>());
    }
    
  • Marian 2 posts 72 karma points
    Sep 10, 2020 @ 20:39
    Marian
    0

    Thanks for reply Kevin, but how i should bind my custom composer and custom serializer?

  • Mahmoud 15 posts 85 karma points
    Oct 12, 2022 @ 09:16
    Mahmoud
    0

    Her is an example :

     [SyncSerializer("EBCD359D-295C-4B8B-B5CF-D44690DC5FB1", "CustomContentTypeSerlializer", uSyncConstants.Serialization.ContentType)]
          public class CustomContentTypeSerlializer : ContentTypeSerializer
          {
            private readonly IContentTypeService contentTypeService;
            private readonly IFileService fileService;
    
            public CustomContentTypeSerlializer(
                IEntityService entityService, ILogger logger,
                IDataTypeService dataTypeService,
                IContentTypeService contentTypeService,
                IFileService fileService)
                : base(entityService, logger, dataTypeService, contentTypeService, fileService)
            {
              this.contentTypeService = contentTypeService;
              this.fileService = fileService;
            }
        }
    
    
          [SyncHandler("uSync8CustomContentTypeHandler", "DocTypes", "ContentTypes", uSyncBackOfficeConstants.Priorites.ContentTypes,
                   IsTwoPass = true, Icon = "icon-item-arrangement", EntityType = UdiEntityType.DocumentType)]
          public class uSync8CustomContentTypeHandler : ContentTypeHandler
          {
            private readonly IContentTypeService contentTypeService;
    
            public uSync8CustomContentTypeHandler(
                IContentTypeService contentTypeService,
                IEntityService entityService,
                IProfilingLogger logger,
                AppCaches appCaches,
                CustomContentTypeSerlializer serializer,
                ISyncItemFactory syncItemFactory,
                SyncFileService syncFileService)
                : base(contentTypeService, entityService, logger, appCaches, serializer, syncItemFactory, syncFileService)
            {
              this.contentTypeService = contentTypeService;
            }
          }
        }
    
        public class uSync8IocComposer : IUserComposer
          {
    
            public void Compose(Composition composition)
            {
              composition.Register<CustomContentTypeSerlializer>();
    
            }
          }
    
Please Sign in or register to post replies

Write your reply to:

Draft