Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Enhancement]: Best practice for constructor injection how-to (markdown page in repo)

Open
#7,422 3 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp
Domain
documentation

Research direction

Start with the linked DNN WebForms dependency-injection documentation, then review PRs #2774 and #4098 to understand the existing activation and pipeline behavior. The issue asks for a Markdown how-to page with a tightly scoped example; done means the page gives verified guidance on constructor injection with WebObjectActivator, notes any DNN-specific caveats, and links to the example.

Written by the indexing model from the issue text.

Description

Status: New
Is there an existing issue for this?
  • I have searched the existing issues
Description of problem

Teams building a WebForms-pattern module (.ascx/code-behind) on DNN Platform 10.x, targeting .NET Framework 4.8, and want to use real constructor injection rather than a static service-locator pattern for module dependencies. Since .NET Framework 4.7.2, System.Web.HttpRuntime.WebObjectActivator allows true constructor injection into Page/UserControl/MasterPage. Before teams adopt it, they would want to check DNN's official guidance and current status directly.

  1. I have came across an earlier note (around #2774 / #4098 and the DotNetNuke.ModulePipeline/ModuleControlPipeline work) that an initial attempt at using WebObjectActivator caused crashes, possibly related to ClientDependency. Has that been root-caused and resolved? Is WebObjectActivator-based construction considered safe for DNN module activation today?
  2. The current DI docs cover MVC, Razor3, and SPA/Web API modules — is there an equivalent, officially recommended pattern for getting constructor injection specifically into a classic WebForms module's UserControl code-behind via WebObjectActivator, or is property/setter injection still the supported approach for that module pattern?
  3. Does ModuleControlPipeline/IModuleControlPipeline interact with WebObjectActivator in a way teams should account for, or are they unrelated mechanisms that happen to both be part of the DI story?
  4. For reference, the shape of wiring I have evaluated is the same as Microsoft's own (now-retired, reference-only) AspNetWebFormsDependencyInjection sample - setting HttpRuntime.WebObjectActivator from Application_Start via a small IServiceProvider adapter over the container. Is that general
    approach (regardless of container) known to be compatible with DNN's module activation, or is there a DNN-specific gotcha we should know about first?
  5. Last reference - I co-created PicoContainer for Java before Depencency Injection was called that. Later, Unity container methods looked a lot like PicoContainer;s ones.

TL;DR: Current D.I best-practice codified in a how-to page would be fantastic :) :)

Sources

Description of solution

Markdown page talking about pattern and linking to tight example code (or project)

Description of alternatives considered

Briefly considered ServiceLocator and Singleton (dssign patterns) but the last 26 years of my career have been spent arguing against those!

Anything else?

No response

Do you plan to contribute code for this enhancement?
  • Yes
Would you be interested in sponsoring this enhancement?
  • Yes
Code of Conduct
  • I agree to follow this project's Code of Conduct
Dominant language
C#
Stars
1.1k
Forks
791
Avg merge
2d 2h
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dnnsoftware/Dnn.Platform

All issues in dnnsoftware/Dnn.Platform

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.