Closed Arash-Sabet closed 5 years ago
@Arash-Sabet There are no Autofac samples. However, using any DI with Polly is fairly simple: a typical strategy is to register an IPolicyRegistry<string>
with the DI container and have the container inject IPolicyRegistry<string>
into components which need it. Within the component, retrieve the policy you require from the registry.
If on the other hand your question concerns Polly with HttpClientFactory, then this is less straightforward: HttpClientFactory
is fairly tightly coupled to Microsoft.Extensions.DependencyInjection
. See these two threads for deeper discussion and suggestions of possible workrounds: https://github.com/aspnet/HttpClientFactory/issues/148 ; https://github.com/aspnet/Extensions/issues/1345
Anybody from the community who has Autofac samples, please feel free to chip in!
Closing due to lack of further comment
Summary: What are you wanting to achieve?
I'd like to wire up Polly by Autofac. Are there any samples or guidelines to tell us how?
What code or approach do you have so far?
None.