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.
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.
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
is working on a reply...