'DNN: Resolve IPortalInfo service

I'm trying to use dependency injection in DNN to resolve the IPortalInfo service in my SchedulerClient and in my FeatureController. I want to access the current PortalId somehow. But for the SchedulerClient I receive the following error when trying to use the constructor dependency injection:

Unable to resolve service for type 'DotNetNuke.Abstractions.Portals.IPortalInfo' while attempting to activate 'XXX'.

For the FeatureController class it is not working either since it requires a parameterless constructor. Is there any other way to resolve the IPortalInfo service. Currently I'm using the DotNetNuke.Entities.Portals.PortalInfo class but it is deprecated.

(IPortalInfo)DependencyProvider.GetService(typeof (IPortalInfo)); using the PortalModuleBase is not working for the IPortalInfo.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source