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 AddNpgsqlDataSource with DI service key #5134

Closed
roji opened this issue Jun 28, 2023 · 3 comments · Fixed by #5387
Closed

Add AddNpgsqlDataSource with DI service key #5134

roji opened this issue Jun 28, 2023 · 3 comments · Fixed by #5387
Assignees
Milestone

Comments

@roji
Copy link
Member

roji commented Jun 28, 2023

Npgsql.DependencyInjection allows registering an NpgsqlDataSource in DI. .NET 8.0 is adding support for keyed services (docs); we should add AddNpgsqlDataSource overloads which accept a key. This is ideal for registering multiple data sources in the same DI container, and later selecting which one you want via e.g. [FromKeyedServices].

@roji roji added this to the 8.0.0 milestone Jun 28, 2023
@roji roji changed the title Add AddNpgsqlDataSource with service key Add AddNpgsqlDataSource with DI service key Jul 26, 2023
@adamsitnik
Copy link

I would be happy to contribute new methods that use keyed DI, my only question is when is the right time to do that?

Keyed DI was introduced in .NET 8 Preview 7, but it requires RC1 bits (dotnet/runtime#89509 is a must have). RC1 bits are not available at nuget.org, so my question is when should I send the PR: when they become available (few weeks from now) or when .NET 8 is officially shipped (November)?

@roji
Copy link
Member Author

roji commented Aug 28, 2023

Thanks @adamsitnik! I think once rc1 ships, we're likely to also ship the Npgsql rc1 very soon after that. That point would like be best for doing a PR (so before rc2). Would be great to have a contribution for this!

@roji
Copy link
Member Author

roji commented Oct 26, 2023

@adamsitnik just in case you're still interested in this :) If not I'll try to do it before GA.

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.

3 participants