From 851d8ea2b93cf2e60a72be4dcc7784d40f670c7e Mon Sep 17 00:00:00 2001 From: Valters Melnalksnis Date: Wed, 15 Jun 2022 22:37:59 +0300 Subject: [PATCH] fix: Use IOptionsMonitor instead of IOptionsSnapshot to avoid lifetime issues --- .../ServiceCollectionExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/VMelnalksnis.NordigenDotNet.DependencyInjection/ServiceCollectionExtensions.cs b/source/VMelnalksnis.NordigenDotNet.DependencyInjection/ServiceCollectionExtensions.cs index 84f5d91..ea47c35 100644 --- a/source/VMelnalksnis.NordigenDotNet.DependencyInjection/ServiceCollectionExtensions.cs +++ b/source/VMelnalksnis.NordigenDotNet.DependencyInjection/ServiceCollectionExtensions.cs @@ -60,10 +60,10 @@ public static class ServiceCollectionExtensions .AddTransient() .AddTransient() .AddTransient() - .AddTransient(provider => provider.GetRequiredService>().Value) + .AddTransient(provider => provider.GetRequiredService>().CurrentValue) .AddHttpClient((provider, client) => { - client.BaseAddress = provider.GetRequiredService>().Value.BaseAddress; + client.BaseAddress = provider.GetRequiredService>().CurrentValue.BaseAddress; var assembly = typeof(INordigenClient).Assembly.GetName();