I'm trying to get the Sitecore context using:
var context = new SitecoreContentContext();
var item = context.GetItem<Sitecore.Data.Items.Item>("/sitecore/content/home");
But the item assignment throws a Null Exception Error. When I debug the context variable, the property Database
is null. If I set that property to "master" on debug mode, it works. But I don't know why that property null.
Does any one have any advice?
Thanks
Sitecore.Context.ContentDatabase
available at that time?Sitecore.Data.DatabaseSwitcher