I have a refit client (IMyRefitClient
) that returns
Task<ApiResponse<ADomainModel>>
I can't inject this refit client in Program.cs with HostBuilder.ConfigureServices
because the url isn't known until runtime. Therefore, I'm using a factory class like:
return RestService.For<IMyRefitClient>(hostUrl);
I know how to add a policy in ConfigureServices
. It would look like:
services.AddRefitClient<IMyRefitClient>()
.AddPolicyHandler(PollyHelpers.GetRetryPolicy());
Is there a way that I can add this policy when using the factory class?