I have hangfire installed and running successfully, unfortunatly I cannot seem to access the umbraco context on a hangfire job, everything I have read indicates you can just inject it in and off you go.
But doing this:
public void ManipulateContent(PerformContext context)
{
using var _ = _umbracoContextFactory.EnsureUmbracoContext();
using var serviceScope = _serviceProvider.CreateScope();
var query = serviceScope.ServiceProvider.GetRequiredService<IPublishedContentQuery>();
var rootNode = query.ContentAtRoot().FirstOrDefault();
if (rootNode == null) return;
context.WriteLine($"Root node - Id: {rootNode.Id} | Name: {rootNode.Name}");
}
The rootNode is always null. I am a bit stumped, anyone got any tips on direction?
Hangfire Umbraco Context Access
Followed this guide to update content via hangfire:
https://cultiv.nl/blog/using-hangfire-to-update-umbraco-content/
I have hangfire installed and running successfully, unfortunatly I cannot seem to access the umbraco context on a hangfire job, everything I have read indicates you can just inject it in and off you go.
But doing this:
The rootNode is always null. I am a bit stumped, anyone got any tips on direction?
Hi,
I don't know if this will, help you, but I use a class which contains my Hangfir Jobs.
The jobs are added using a dashboard and API controller, example below
is working on a reply...