Introduce AddKeyedAwsService to register keyed services #3561
Labels
feature-request
A feature should be added or improved.
module/sdk-custom
p2
This is a standard priority issue
pr/needs-review
This PR needs a review from a Member.
queued
Describe the feature
Introduce AddKeyedAwsService which allows register multiple services of the same type with different keys. Then those services can be injected into other components using FromKeyedServices
Use case
I have a service which needs to access S3 buckets in different AWS regions. Different components of the service inject IAmazonS3 instances, but those have to be configured differently.
Proposed solution
It could be
Such design is aligned with keyed services functionality of Microsoft.Extensions.DependencyInjection:
Other Information
I could implement my own extension methods for my case if
Amazon.Extensions.NETCore.Setup.ClientFactory
was public.I ended up with registering clents using
but it feels hacky, and I assume can cause problems I don't see now.
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Extensions.NETCore.Setup 3.7
Targeted .NET Platform
.NET 8.0
Operating System and version
MacOS Ventura
The text was updated successfully, but these errors were encountered: