I am trying to retrieve a Sitecore.Data.Items.Item
using this line:
var myItem = Context.Database.GetItem("/sitecore/content/x");
but instead of an Item I get a null exception. I have also tried
var myItem = Context.Data.Database.GetItem("/sitecore/content/x")
with same result. It seems like Database is null and when I try to veryfy that with:
var databases = Sitecore.Configuration.Factory.GetDatabases();
I get an empty list back. I have also tried to get a database item directly with:
string databaseName = "master";
var db = Sitecore.Configuration.Factory.GetDatabase(databaseName);
but that gave me another exception
Message = "Could not find configuration node: databases/database[@id='master']"
At other places in the code it works fine to retrive Sitecore Items. Where it does work, I have a CommercePipelineExecutionContext (even though I don't directly uses it. Where it doesn't work I have a CommerceContext in which I have not found any database info. Any pointers to why this isn't working in this spot when it does work in others are appreciated.