Skip to content

I hope to add ServeiceKey to the IOnServiceRegistrdContext interface #22741

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

Closed
1 task done
LenFon opened this issue Apr 22, 2025 · 1 comment · Fixed by #22744
Closed
1 task done

I hope to add ServeiceKey to the IOnServiceRegistrdContext interface #22741

LenFon opened this issue Apr 22, 2025 · 1 comment · Fixed by #22744

Comments

@LenFon
Copy link

LenFon commented Apr 22, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

No response

Describe the solution you'd like

When passing an Action to the OnRegistered method, in some cases, the ServiceKey needs to be used as a judgment condition. For example:

context.Services.OnRegistered(context=>{
    if(context.ServiceKey.ToString() == "A"){
        // do something ...
    }
});

Additional context

No response

@LenFon
Copy link
Author

LenFon commented Apr 22, 2025

ServiceKey is the same as the serviceKey parameter in the “context.Services.AddKeyedScoped” method.

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

Successfully merging a pull request may close this issue.

2 participants