I’m running Orchard Core and have created a custom IRule
that needs to query the Content Items. (Obviously querying the DB is time-consuming, so we only do this if something happened and we need to rebuild our redirects cache.) To do so, I am getting an IOrchardHelper
from the service provider, and using that helper, I’m executing
var listCi = await orchardHelper.GetContentItemByAliasAsync("redirects-list", false);
However, this is throwing a NullReferenceException
, because GetService<ISession>()
returns null
, but AliasPartContentHandleHelper.QueryAliasIndex(session, alias)
assumes that session is non-null.
Is there anyway to adjust things so that GetService<ISession>()
returns a session?