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

Add support for keyed services #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

veselfil
Copy link

@veselfil veselfil commented May 12, 2024

A quick fix to add support for Keyed services introduced in .NET 8

@christianarg
Copy link

(I'm not contributor). +1 for this PR but seems it doesn't compile https://ci.appveyor.com/project/unitycontainer/microsoft-dependency-injection-02uof/builds/49796976

@veselfil
Copy link
Author

@microsoft-github-policy-service agree

@lvxiaoxin
Copy link

lvxiaoxin commented Jan 7, 2025

@veselfil Does this PR going to complete? Hit similar issues and trying to seek support for keyed services in the package as well.

else if (serviceDescriptor.KeyedImplementationFactory != null)
{
container.RegisterFactory(serviceDescriptor.ServiceType,
(string)serviceDescriptor.ServiceKey,
Copy link

@lvxiaoxin lvxiaoxin Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@veselfil this need to change as serviceDescriptor.ServiceKey.ToString() instead of casting directly, otherwise it may throw exceptions in some scenario.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for other places about casting as string

@lvxiaoxin
Copy link

lvxiaoxin commented Jan 9, 2025

@ENikS Would you please check this proposal? This is related to this discussion: dotnet/runtime#95789

Thanks

@lvxiaoxin
Copy link

Just noticed this, I'm sorry... https://www.gofundme.com/f/eugene-sadovoi

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

Successfully merging this pull request may close these issues.

3 participants