-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Make DI example compilable #51187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make DI example compilable #51187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR consolidates the dependency injection example code to make it compilable as a single standalone project. The changes move code from separate files in the dependency-injection folder into a single Program.cs file in the overview folder, remove explicit namespaces to use implicit global namespace (enabled by ImplicitUsings), and update the documentation to reference the consolidated code.
Changes:
- Consolidated
Worker,MessageWriter, andIMessageWriterclasses into a singleProgram.csfile with snippet markers - Removed the
RootNamespaceproperty from the project file to enable global namespace compilation - Removed namespace declarations from
LoggingMessageWriter.cs - Deleted the
dependency-injectionfolder and its separate source files - Updated markdown documentation to reference the consolidated code snippets
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/core/extensions/snippets/configuration/overview/dependency-injection.csproj | Removed RootNamespace property to allow implicit global namespace |
| docs/core/extensions/snippets/configuration/overview/Program.cs | Created consolidated program with all DI example classes and snippet markers |
| docs/core/extensions/snippets/configuration/overview/LoggingMessageWriter.cs | Removed namespace declaration for global namespace compilation |
| docs/core/extensions/snippets/configuration/dependency-injection/Worker.cs | Deleted - consolidated into Program.cs |
| docs/core/extensions/snippets/configuration/dependency-injection/Program.cs | Deleted - consolidated into overview/Program.cs |
| docs/core/extensions/snippets/configuration/dependency-injection/MessageWriter.cs | Deleted - consolidated into overview/Program.cs |
| docs/core/extensions/snippets/configuration/dependency-injection/IMessageWriter.cs | Deleted - consolidated into overview/Program.cs |
| docs/core/extensions/dependency-injection.md | Updated snippet references and descriptions for the consolidated code |
BillWagner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM @gewarren
Let's ![]()
Fixes #50694 by putting all required components into a single code file that's displayed in the snippet window.
Internal previews