Skip to content

Add support for keyed services#97

Open
veselfil wants to merge 2 commits into
unitycontainer:masterfrom
veselfil:veselfil/keyedServices
Open

Add support for keyed services#97
veselfil wants to merge 2 commits into
unitycontainer:masterfrom
veselfil:veselfil/keyedServices

Conversation

@veselfil

@veselfil veselfil commented May 12, 2024

Copy link
Copy Markdown

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

@christianarg

Copy link
Copy Markdown

(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
Copy Markdown
Author

@microsoft-github-policy-service agree

@lvxiaoxin

lvxiaoxin commented Jan 7, 2025

Copy link
Copy Markdown

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

Comment thread src/Configuration.cs
else if (serviceDescriptor.KeyedImplementationFactory != null)
{
container.RegisterFactory(serviceDescriptor.ServiceType,
(string)serviceDescriptor.ServiceKey,

@lvxiaoxin lvxiaoxin Jan 9, 2025

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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

lvxiaoxin commented Jan 9, 2025

Copy link
Copy Markdown

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

Thanks

@lvxiaoxin

Copy link
Copy Markdown

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