From ca887d7afaee3e724c7405b34b5ea24defaa0bd3 Mon Sep 17 00:00:00 2001 From: dudu Date: Sun, 29 Jan 2023 18:58:26 +0800 Subject: [PATCH] refactor: remove configuration section check --- .../EnyimMemcachedServiceCollectionExtensions.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/Enyim.Caching/EnyimMemcachedServiceCollectionExtensions.cs b/src/Enyim.Caching/EnyimMemcachedServiceCollectionExtensions.cs index d9e002f1..16f67ba2 100644 --- a/src/Enyim.Caching/EnyimMemcachedServiceCollectionExtensions.cs +++ b/src/Enyim.Caching/EnyimMemcachedServiceCollectionExtensions.cs @@ -67,11 +67,6 @@ public static IServiceCollection AddEnyimMemcached( throw new ArgumentNullException(nameof(configurationSection)); } - if (!configurationSection.Exists()) - { - throw new ArgumentNullException($"{configurationSection.Key} in appsettings.json"); - } - return services.AddEnyimMemcachedInternal( s => s.Configure(configurationSection), asDistributedCache); } @@ -93,10 +88,6 @@ public static IServiceCollection AddEnyimMemcached( } var section = configuration.GetSection(sectionKey); - if (!section.Exists()) - { - throw new ArgumentNullException($"{sectionKey} in appsettings.json"); - } return services.AddEnyimMemcachedInternal( s => s.Configure(section), asDistributedCache); @@ -157,12 +148,6 @@ public static IServiceCollection AddEnyimMemcached( throw new ArgumentNullException(nameof(configuration)); } - var section = configuration.GetSection(sectionKey); - if (!section.Exists()) - { - throw new ArgumentNullException($"{sectionKey} in appsettings.json"); - } - return services.AddEnyimMemcached( s => s.Configure(configuration.GetSection(sectionKey))); }