DNN: Resolve IPortalInfo service

138 Views Asked by At

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.

1

There are 1 best solutions below

0
On

AFAIK there is no way to use dependency injection in DNN in other classes than webforms code-behind at the moment.