Skip to content
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

Feature request: Control the visibility of DiscoveredServicesExtensions #45

Open
alexrp opened this issue Aug 22, 2023 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@alexrp
Copy link

alexrp commented Aug 22, 2023

Hi!

Thanks for putting this project together. It's saved me a fair bit of boilerplate. 🙂

I was wondering if it would be possible to add an MSBuild property to control the visibility of the generated DiscoveredServicesExtensions class? Specifically, here:

codeBuilder
.AppendLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute]")
.AppendLine("[global::System.Diagnostics.DebuggerStepThroughAttribute]")
.AppendLine("public static class DiscoveredServicesExtensions")
.AppendLine("{")

In my solution, I have a few different projects for different areas of the application. Each such project already exposes a <Project>ServiceCollectionExtensions class with methods to register everything. This class needs to stay because, even when using Injectio, there are various essential services defined outside the assembly that also need to be added (e.g. ASP.NET Core stuff, AddOptions<T>(), etc...). So I figure I'll just call Injectio's generated method from there. That means exposing DiscoveredServicesExtensions publicly isn't necessary (and kind of a trap since it lacks those essential service registrations).

I figure this feature could just look something like <InjectioVisibility>internal</InjectioVisibility> (defaulting to public).

@pwelter34 pwelter34 added the enhancement New feature or request label Aug 23, 2023
@pwelter34
Copy link
Member

seems reasonable, I'll add it to list of things todo. thanks for the suggestion.

@MysterDru
Copy link

Any update on this request? I'd benefit from this greatly as I have a similar setup within some of my projects.

I'd be happy to author and submit a pull request to add this if that is preferable.

pwelter34 added a commit that referenced this issue Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants