I am trying to get my hands around using Dependency Injection with DNN. I looked at the DotNetNuke.Startup class and see the following:
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<WebFormsModuleControlFactory>();
services.AddSingleton<Html5ModuleControlFactory>();
services.AddSingleton<ReflectedModuleControlFactory>();
services.AddSingleton<IDnnContext, DotNetNukeContext>();
services.AddScoped<IEventLogger, EventLogController>();
services.AddScoped<IEventLogConfigService, EventLogController>();
services.AddScoped<IEventLogService, EventLogController>();
services.AddTransient((IServiceProvider x) => ServiceLocator<IPortalController, PortalController>.Instance);
services.AddScoped<IHostSettingsService, HostController>();
services.AddScoped<INavigationManager, NavigationManager>();
services.AddScoped<ISerializationManager, SerializationManager>();
services.AddScoped<IApplicationInfo, DotNetNuke.Application.Application>();
services.AddScoped<IApplicationStatusInfo, ApplicationStatusInfo>();
services.AddScoped<IPortalAliasService, PortalAliasController>();
}
I have an understanding on how to wire up those services, but my confusion comes into play on how to register other dependencies that are not specific to DNN services for a Web Forms application (a new custom service).
Does anyone have any experience with this? In my Web Forms project, do I have to create a new Startup class that inherits the DNN Interface for Startup? Any examples would be greatly appreciated.