UmbracoContext.EnsureContext vs UmbracoContext.CreateContext
Im using https://www.quartz-scheduler.net to schedule some archiving in Umbraco. Since these "jobs" are done outside of UmbracoContext (not started by a web request) I have to create the UmbracoContext myself (right?). I do this by calling:
var umbContext = UmbracoContext.CreateContext(
dummyHttpContext,
ApplicationContext.Current,
new WebSecurity(dummyHttpContext, ApplicationContext.Current),
UmbracoConfig.For.UmbracoSettings(),
UrlProviderResolver.Current.Providers,
false)
var umbHelper = new UmbracoHelper(umbContext);
// bla bla bla do stuff
But I just noticed UmbracoContext.CreateContext. What is the difference from UmbracoContext.CreateContext and when should I use which?
I also wonder if its safe to use these? Will they be "destroyed" when my "Jobs"-code has been finished?
UmbracoContext.EnsureContext vs UmbracoContext.CreateContext
Im using https://www.quartz-scheduler.net to schedule some archiving in Umbraco. Since these "jobs" are done outside of UmbracoContext (not started by a web request) I have to create the UmbracoContext myself (right?). I do this by calling:
But I just noticed
UmbracoContext.CreateContext
. What is the difference fromUmbracoContext.CreateContext
and when should I use which?I also wonder if its safe to use these? Will they be "destroyed" when my "Jobs"-code has been finished?
is working on a reply...