Describe the feature
Allow configuring clientConfig.HttpClientFactory through dependency injection factories.
Use Case
I'm faced with the problem that it's not possible to configure clientConfig.HttpClientFactory through AddAWSService<>; there's no overload that allows you to configure that instance using IServiceProvider.
I know that many AWSOptions options can be configured from appsettings.json for example, but that AWSOptions only has a subset of ClientConfig fields and only primitive type fields, not for those that require, for example, an instance of HttpClientFactory:
|
private ClientConfig CreateConfig(AWSOptions options) |
The DefaultClientConfig class does not allow to configure HttpClientFactory:
|
public class DefaultClientConfig |
In my case, I would like to build it with the default factory but be able to configure it later in another step. My intention is to use IAmazonS3 but with: https://learn.microsoft.com/es-es/dotnet/core/extensions/httpclient-factory
Currently, the only way (without using DI, in my case it's not possible as I'm using IHttpClientFactory from Microsoft) is to set AWSConfigs.HttpClientFactory, but this is not ideal as it is static:
|
public HttpClientFactory HttpClientFactory { get; set; } = AWSConfigs.HttpClientFactory; |
Proposed Solution
I suppose it could be solved with a minor change in one of the many PRs created by @chase-miller: #3715 (comment)
I hope they get unblocked somehow because he has done a tremendous job.
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Extensions.NETCore.Setup -> 4.0.3.9
AWSSDK.S3 -> 4.0.9.1
Targeted .NET Platform
.NET 9
Operating System and version
Windows 11
Describe the feature
Allow configuring
clientConfig.HttpClientFactorythrough dependency injection factories.Use Case
I'm faced with the problem that it's not possible to configure
clientConfig.HttpClientFactorythroughAddAWSService<>; there's no overload that allows you to configure that instance using IServiceProvider.I know that many
AWSOptionsoptions can be configured from appsettings.json for example, but thatAWSOptionsonly has a subset of ClientConfig fields and only primitive type fields, not for those that require, for example, an instance ofHttpClientFactory:aws-sdk-net/extensions/src/AWSSDK.Extensions.NETCore.Setup/ClientFactory.cs
Line 221 in dc51341
The
DefaultClientConfigclass does not allow to configure HttpClientFactory:aws-sdk-net/extensions/src/AWSSDK.Extensions.NETCore.Setup/DefaultClientConfig.cs
Line 24 in dc51341
In my case, I would like to build it with the default factory but be able to configure it later in another step. My intention is to use
IAmazonS3but with: https://learn.microsoft.com/es-es/dotnet/core/extensions/httpclient-factoryCurrently, the only way (without using DI, in my case it's not possible as I'm using IHttpClientFactory from Microsoft) is to set
AWSConfigs.HttpClientFactory, but this is not ideal as it is static:aws-sdk-net/sdk/src/Core/Amazon.Runtime/_netstandard/ClientConfig.cs
Line 123 in dc51341
Proposed Solution
I suppose it could be solved with a minor change in one of the many PRs created by @chase-miller: #3715 (comment)
I hope they get unblocked somehow because he has done a tremendous job.
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Extensions.NETCore.Setup -> 4.0.3.9
AWSSDK.S3 -> 4.0.9.1
Targeted .NET Platform
.NET 9
Operating System and version
Windows 11