Copied to clipboard

Flag this post as spam?

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


  • drummerboy46 26 posts 88 karma points
    Mar 04, 2024 @ 13:28
    drummerboy46
    0

    IContentService in Custom Migration

    Is IContentService the only way to retrieve content when running a custom migration (inheriting from MigrationBase)

    Is there any way I can get PublishedContent Context? I want rapid read-only access without hitting the database.

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Mar 05, 2024 @ 09:49
    Nik
    0

    Hi Drummerboy,

    The answer kind of depends, you could inject in a IUmbracoContextAccessorFactory and try and get an Umbraco Context. This "should" give you access to the published content cache, however I'm not certain what state the published cache will be at the point migrations run.

    Also, it depends what you are trying to do because if you need access to unpublished content I don't believe that will give you the access you need and you are safer using the IContentService.

    Thanks

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft