Copied to clipboard

Flag this post as spam?

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


  • Kristoffer Eriksen 185 posts 465 karma points
    Feb 17, 2023 @ 09:21
    Kristoffer Eriksen
    0

    Trigger custom serializer

    I have a custom serializer in Umbraco8, that gets triggered when registering the new serializer in a composer.

     composition.Register(typeof(ISyncSerializer<IContentType>), typeof(USyncContentTypeSerializer), Lifetime.Singleton);
    

    But the same (althought rewritten to .NET6) implementation doesn't work in Umbraco 10. Is there another way to register it in Umbraco 10?

    I'm doing it this way, But doesn't work

    builder.Services.AddSingleton<ISyncSerializer<IContentType>, USyncContentTypeSerializer>()
    
  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Feb 17, 2023 @ 10:57
    Kevin Jump
    100

    Hi ,

    In v10 you don't need to specifically register the serializer, as long as it implements ISyncSerializer it will be loaded.

    However the handlers etc won't use it unless you remove the existing content TypeSerializer

    builder.WithCollectionBuilder<SyncSerializerCollectionBuilder>()
           .Remove<ContentTypeSerializer>();
    
  • Kristoffer Eriksen 185 posts 465 karma points
    Feb 17, 2023 @ 14:21
    Kristoffer Eriksen
    0

    Thanks Kevin That absolutely solved it :-)

Please Sign in or register to post replies

Write your reply to:

Draft