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

Abylity to Register keyed service with AnyKey #119

Open
dmitry-bym opened this issue Mar 22, 2024 · 1 comment
Open

Abylity to Register keyed service with AnyKey #119

dmitry-bym opened this issue Mar 22, 2024 · 1 comment

Comments

@dmitry-bym
Copy link

So its not able to use this cause it's not const. I'm a little confused that the dotnet team decided to use a non-constant value for the key, maybe cause boxing - who knows

[RegisterSingleton(ServiceKey = KeyedService.AnyKey)]

Maybe its possible just to create an enum, and then handle it while source gen, kind of this

public enum ServiceKey { AnyKey }
[RegisterSingleton(ServiceKey = ServiceKey.AnyKey)]
@dmitry-bym
Copy link
Author

Thought for a while, it's not good to have two members for same stuff ServiceKey.AnyKey and KeyedService.AnyKey will create confusion, maybe better just add simple flag IsAnyKey, default = false, if true it ignores ServiceKey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant