Browse Source

Get<T>改名为GetValue<T>

黄中银 1 week ago
parent
commit
c1bc4d38a7
56 changed files with 230 additions and 230 deletions
  1. 1 1
      Apq.Cfg/CfgRootExtensions.cs
  2. 3 3
      Apq.Cfg/CfgSection.cs
  3. 4 4
      Apq.Cfg/ICfgRoot.cs
  4. 2 2
      Apq.Cfg/ICfgSection.cs
  5. 2 2
      Apq.Cfg/Internal/ValueCache.cs
  6. 3 3
      Apq.Cfg/MergedCfgRoot.cs
  7. 2 2
      Samples/Apq.Cfg.Samples/Demos/BasicUsageDemo.cs
  8. 1 1
      Samples/Apq.Cfg.Samples/Demos/BatchOperationsDemo.cs
  9. 1 1
      Samples/Apq.Cfg.Samples/Demos/ConfigSectionDemo.cs
  10. 4 4
      Samples/Apq.Cfg.Samples/Demos/ConsulDemo.cs
  11. 4 4
      Samples/Apq.Cfg.Samples/Demos/DatabaseDemo.cs
  12. 1 1
      Samples/Apq.Cfg.Samples/Demos/DynamicReloadDemo.cs
  13. 4 4
      Samples/Apq.Cfg.Samples/Demos/EtcdDemo.cs
  14. 4 4
      Samples/Apq.Cfg.Samples/Demos/NacosDemo.cs
  15. 4 4
      Samples/Apq.Cfg.Samples/Demos/RedisDemo.cs
  16. 4 4
      Samples/Apq.Cfg.Samples/Demos/VaultDemo.cs
  17. 4 4
      Samples/Apq.Cfg.Samples/Demos/ZookeeperDemo.cs
  18. 8 8
      benchmarks/Apq.Cfg.Benchmarks/BatchOperationBenchmarks.cs
  19. 3 3
      benchmarks/Apq.Cfg.Benchmarks/CacheBenchmarks.cs
  20. 3 3
      benchmarks/Apq.Cfg.Benchmarks/ConcurrencyBenchmarks.cs
  21. 3 3
      benchmarks/Apq.Cfg.Benchmarks/KeyPathBenchmarks.cs
  22. 2 2
      benchmarks/Apq.Cfg.Benchmarks/MicrosoftConfigBenchmarks.cs
  23. 2 2
      benchmarks/Apq.Cfg.Benchmarks/MultiSourceBenchmarks.cs
  24. 6 6
      benchmarks/Apq.Cfg.Benchmarks/ReadWriteBenchmarks.cs
  25. 9 9
      benchmarks/Apq.Cfg.Benchmarks/SaveBenchmarks.cs
  26. 7 7
      benchmarks/Apq.Cfg.Benchmarks/TypeConversionBenchmarks.cs
  27. 4 4
      benchmarks/Apq.Cfg.Benchmarks/ZookeeperBenchmarks.cs
  28. 1 1
      benchmarks/README.md
  29. 3 3
      docs/site/api/extensions.md
  30. 3 3
      docs/site/api/icfg-root.md
  31. 2 2
      docs/site/en/guide/migration.md
  32. 1 1
      docs/site/guide/basic-usage.md
  33. 2 2
      docs/site/guide/migration.md
  34. 1 1
      docs/单元测试覆盖分析报告.md
  35. 3 3
      tests/Apq.Cfg.Tests.Shared/BoundaryConditionTests.cs
  36. 10 10
      tests/Apq.Cfg.Tests.Shared/CfgBuilderAdvancedTests.cs
  37. 6 6
      tests/Apq.Cfg.Tests.Shared/CfgRootExtensionsTests.cs
  38. 1 1
      tests/Apq.Cfg.Tests.Shared/CfgSectionTests.cs
  39. 5 5
      tests/Apq.Cfg.Tests.Shared/ConcurrencyTests.cs
  40. 9 9
      tests/Apq.Cfg.Tests.Shared/ConsulCfgTests.cs
  41. 1 1
      tests/Apq.Cfg.Tests.Shared/CryptoTests.cs
  42. 6 6
      tests/Apq.Cfg.Tests.Shared/DatabaseCfgTests.cs
  43. 1 1
      tests/Apq.Cfg.Tests.Shared/EncodingTests.cs
  44. 5 5
      tests/Apq.Cfg.Tests.Shared/EnvCfgTests.cs
  45. 9 9
      tests/Apq.Cfg.Tests.Shared/EtcdCfgTests.cs
  46. 7 7
      tests/Apq.Cfg.Tests.Shared/ExceptionHandlingTests.cs
  47. 1 1
      tests/Apq.Cfg.Tests.Shared/IniCfgTests.cs
  48. 1 1
      tests/Apq.Cfg.Tests.Shared/JsonCfgTests.cs
  49. 28 28
      tests/Apq.Cfg.Tests.Shared/PerformanceOptimizationTests.cs
  50. 6 6
      tests/Apq.Cfg.Tests.Shared/RedisCfgTests.cs
  51. 1 1
      tests/Apq.Cfg.Tests.Shared/TomlCfgTests.cs
  52. 9 9
      tests/Apq.Cfg.Tests.Shared/VaultCfgTests.cs
  53. 1 1
      tests/Apq.Cfg.Tests.Shared/XmlCfgTests.cs
  54. 1 1
      tests/Apq.Cfg.Tests.Shared/YamlCfgTests.cs
  55. 9 9
      tests/Apq.Cfg.Tests.Shared/ZookeeperCfgTests.cs
  56. 2 2
      tests/README.md

+ 1 - 1
Apq.Cfg/CfgRootExtensions.cs

@@ -10,7 +10,7 @@ public static class CfgRootExtensions
     /// <summary>
     /// 尝试获取配置值
     /// </summary>
-    public static bool TryGet<T>(this ICfgRoot root, string key, out T? value)
+    public static bool TryGetValue<T>(this ICfgRoot root, string key, out T? value)
     {
         var rawValue = root.Get(key);
         if (rawValue == null)

+ 3 - 3
Apq.Cfg/CfgSection.cs

@@ -24,7 +24,7 @@ internal sealed class CfgSection : ICfgSection
     public string? this[string key]
     {
         get => Get(key);
-        set => Set(key, value);
+        set => SetValue(key, value);
     }
 
     /// <summary>
@@ -50,9 +50,9 @@ internal sealed class CfgSection : ICfgSection
         return _root.Exists(GetFullKey(key));
     }
 
-    public void Set(string key, string? value, int? targetLevel = null)
+    public void SetValue(string key, string? value, int? targetLevel = null)
     {
-        _root.Set(GetFullKey(key), value, targetLevel);
+        _root.SetValue(GetFullKey(key), value, targetLevel);
     }
 
     public void Remove(string key, int? targetLevel = null)

+ 4 - 4
Apq.Cfg/ICfgRoot.cs

@@ -72,11 +72,11 @@ public interface ICfgRoot : IDisposable, IAsyncDisposable
     /// <param name="targetLevel">目标层级,为null时使用可写的最高层级</param>
     /// <example>
     /// <code>
-    /// cfg.Set("Server:Port", "8080");
-    /// cfg.Set("Features:NewUI", "true");
+    /// cfg.SetValue("Server:Port", "8080");
+    /// cfg.SetValue("Features:NewUI", "true");
     /// </code>
     /// </example>
-    void Set(string key, string? value, int? targetLevel = null);
+    void SetValue(string key, string? value, int? targetLevel = null);
 
     /// <summary>
     /// 移除配置键
@@ -144,7 +144,7 @@ public interface ICfgRoot : IDisposable, IAsyncDisposable
     /// </summary>
     /// <param name="values">要设置的键值对</param>
     /// <param name="targetLevel">目标层级</param>
-    void SetMany(IEnumerable<KeyValuePair<string, string?>> values, int? targetLevel = null);
+    void SetManyValues(IEnumerable<KeyValuePair<string, string?>> values, int? targetLevel = null);
 
     // 转换方法
     /// <summary>

+ 2 - 2
Apq.Cfg/ICfgSection.cs

@@ -86,10 +86,10 @@ public interface ICfgSection
     /// <example>
     /// <code>
     /// var dbSection = cfg.GetSection("Database");
-    /// dbSection.Set("Timeout", "60"); // 等同于 cfg.Set("Database:Timeout", "60")
+    /// dbSection.SetValue("Timeout", "60"); // 等同于 cfg.SetValue("Database:Timeout", "60")
     /// </code>
     /// </example>
-    void Set(string key, string? value, int? targetLevel = null);
+    void SetValue(string key, string? value, int? targetLevel = null);
 
     /// <summary>
     /// 移除配置键

+ 2 - 2
Apq.Cfg/Internal/ValueCache.cs

@@ -26,7 +26,7 @@ internal sealed class ValueCache
     /// <param name="key">配置键</param>
     /// <param name="value">缓存的值</param>
     /// <returns>是否命中缓存</returns>
-    public bool TryGet<T>(string key, out T? value)
+    public bool TryGetValue<T>(string key, out T? value)
     {
         var cacheKey = (key, typeof(T).TypeHandle.Value);
         if (_cache.TryGetValue(cacheKey, out var cached))
@@ -44,7 +44,7 @@ internal sealed class ValueCache
     /// <typeparam name="T">目标类型</typeparam>
     /// <param name="key">配置键</param>
     /// <param name="value">要缓存的值</param>
-    public void Set<T>(string key, T? value)
+    public void SetValue<T>(string key, T? value)
     {
         var cacheKey = (key, typeof(T).TypeHandle.Value);
         _cache[cacheKey] = value;

+ 3 - 3
Apq.Cfg/MergedCfgRoot.cs

@@ -95,7 +95,7 @@ internal sealed class MergedCfgRoot : ICfgRoot
     public string? this[string key]
     {
         get => Get(key);
-        set => Set(key, value);
+        set => SetValue(key, value);
     }
 
     public string? Get(string key)
@@ -233,7 +233,7 @@ internal sealed class MergedCfgRoot : ICfgRoot
         data.Pending[key] = null;
     }
 
-    public void Set(string key, string? value, int? targetLevel = null)
+    public void SetValue(string key, string? value, int? targetLevel = null)
     {
         var level = targetLevel ?? (_levelsDescending.Length > 0 ? _levelsDescending[0] : throw new InvalidOperationException("没有配置源"));
         if (!_levelData.TryGetValue(level, out var data) || data.Primary == null)
@@ -244,7 +244,7 @@ internal sealed class MergedCfgRoot : ICfgRoot
         data.Pending[key] = transformedValue;
     }
 
-    public void SetMany(IEnumerable<KeyValuePair<string, string?>> values, int? targetLevel = null)
+    public void SetManyValues(IEnumerable<KeyValuePair<string, string?>> values, int? targetLevel = null)
     {
         var level = targetLevel ?? (_levelsDescending.Length > 0 ? _levelsDescending[0] : throw new InvalidOperationException("没有配置源"));
         if (!_levelData.TryGetValue(level, out var data) || data.Primary == null)

+ 2 - 2
Samples/Apq.Cfg.Samples/Demos/BasicUsageDemo.cs

@@ -65,13 +65,13 @@ public static class BasicUsageDemo
 
         // 修改配置(写入到 isPrimaryWriter 的配置源,需要指定 targetLevel)
         Console.WriteLine("\n1.3 修改配置:");
-        cfg.Set("App:LastRun", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), targetLevel: 1);
+        cfg.SetValue("App:LastRun", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), targetLevel: 1);
         await cfg.SaveAsync(targetLevel: 1);
         Console.WriteLine($"    已设置 App:LastRun = {cfg.Get("App:LastRun")}");
 
         // 删除配置
         Console.WriteLine("\n1.4 删除配置:");
-        cfg.Set("App:TempKey", "临时值", targetLevel: 1);
+        cfg.SetValue("App:TempKey", "临时值", targetLevel: 1);
         Console.WriteLine($"    设置 App:TempKey = {cfg.Get("App:TempKey")}");
         cfg.Remove("App:TempKey", targetLevel: 1);
         await cfg.SaveAsync(targetLevel: 1);

+ 1 - 1
Samples/Apq.Cfg.Samples/Demos/BatchOperationsDemo.cs

@@ -53,7 +53,7 @@ public static class BatchOperationsDemo
             ["Settings:FontSize"] = "16",
             ["Settings:NewOption"] = "enabled"
         };
-        cfg.SetMany(newValues);
+        cfg.SetManyValues(newValues);
         await cfg.SaveAsync();
 
         Console.WriteLine("    批量设置后的值:");

+ 1 - 1
Samples/Apq.Cfg.Samples/Demos/ConfigSectionDemo.cs

@@ -64,7 +64,7 @@ public static class ConfigSectionDemo
         // 通过配置节修改值
         Console.WriteLine("\n3.3 通过配置节修改值:");
         var replicaSection = dbSection.GetSection("Replica");
-        replicaSection.Set("Port", "3308");
+        replicaSection.SetValue("Port", "3308");
         await cfg.SaveAsync();
         Console.WriteLine($"    修改后 Database:Replica:Port = {replicaSection.Get("Port")}");
 

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/ConsulDemo.cs

@@ -181,10 +181,10 @@ public static class ConsulDemo
             Console.WriteLine("    ✓ 连接 Consul 成功");
 
             // 写入测试配置
-            cfg.Set("App:Name", "ConsulDemo");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:Host", "localhost");
-            cfg.Set("Database:Port", "5432");
+            cfg.SetValue("App:Name", "ConsulDemo");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:Host", "localhost");
+            cfg.SetValue("Database:Port", "5432");
             await cfg.SaveAsync();
             Console.WriteLine("    ✓ 写入配置成功");
 

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/DatabaseDemo.cs

@@ -39,9 +39,9 @@ public static class DatabaseDemo
 
             // 写入配置
             Console.WriteLine("\n10.2 写入配置到数据库:");
-            cfg.Set("App:Name", "DatabaseApp");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:MaxConnections", "100");
+            cfg.SetValue("App:Name", "DatabaseApp");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:MaxConnections", "100");
             await cfg.SaveAsync();
             Console.WriteLine("    已写入 3 个配置项");
 
@@ -53,7 +53,7 @@ public static class DatabaseDemo
 
             // 修改配置
             Console.WriteLine("\n10.4 修改配置:");
-            cfg.Set("App:Version", "2.0.0");
+            cfg.SetValue("App:Version", "2.0.0");
             await cfg.SaveAsync();
             Console.WriteLine($"    修改后 App:Version = {cfg.Get("App:Version")}");
 

+ 1 - 1
Samples/Apq.Cfg.Samples/Demos/DynamicReloadDemo.cs

@@ -66,7 +66,7 @@ public static class DynamicReloadDemo
         // 模拟配置变更
         Console.WriteLine("\n6.4 模拟配置变更:");
         Console.WriteLine("    修改 App:RefreshInterval 为 60...");
-        cfg.Set("App:RefreshInterval", "60");
+        cfg.SetValue("App:RefreshInterval", "60");
         await cfg.SaveAsync();
 
         // 等待变更通知

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/EtcdDemo.cs

@@ -216,10 +216,10 @@ public static class EtcdDemo
             Console.WriteLine("    ✓ 连接 Etcd 成功");
 
             // 写入测试配置
-            cfg.Set("App:Name", "EtcdDemo");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:Host", "localhost");
-            cfg.Set("Database:Port", "5432");
+            cfg.SetValue("App:Name", "EtcdDemo");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:Host", "localhost");
+            cfg.SetValue("Database:Port", "5432");
             await cfg.SaveAsync();
             Console.WriteLine("    ✓ 写入配置成功");
 

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/NacosDemo.cs

@@ -259,10 +259,10 @@ public static class NacosDemo
             Console.WriteLine("    ✓ 连接 Nacos 成功");
 
             // 写入测试配置
-            cfg.Set("App:Name", "NacosDemo");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:Host", "localhost");
-            cfg.Set("Database:Port", "5432");
+            cfg.SetValue("App:Name", "NacosDemo");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:Host", "localhost");
+            cfg.SetValue("Database:Port", "5432");
             await cfg.SaveAsync();
             Console.WriteLine("    ✓ 写入配置成功");
 

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/RedisDemo.cs

@@ -34,10 +34,10 @@ public static class RedisDemo
 
             // 写入配置
             Console.WriteLine("\n9.2 写入配置到 Redis:");
-            cfg.Set("App:Name", "RedisApp");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:Host", "db.example.com");
-            cfg.Set("Database:Port", "5432");
+            cfg.SetValue("App:Name", "RedisApp");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:Host", "db.example.com");
+            cfg.SetValue("Database:Port", "5432");
             await cfg.SaveAsync();
             Console.WriteLine("    已写入 4 个配置项");
 

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/VaultDemo.cs

@@ -247,10 +247,10 @@ public static class VaultDemo
             Console.WriteLine("    ✓ 连接 Vault 成功");
 
             // 写入测试配置
-            cfg.Set("App:Name", "VaultDemo");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:Host", "localhost");
-            cfg.Set("Database:Password", "secret-password");
+            cfg.SetValue("App:Name", "VaultDemo");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:Host", "localhost");
+            cfg.SetValue("Database:Password", "secret-password");
             await cfg.SaveAsync();
             Console.WriteLine("    ✓ 写入密钥成功");
 

+ 4 - 4
Samples/Apq.Cfg.Samples/Demos/ZookeeperDemo.cs

@@ -211,10 +211,10 @@ public static class ZookeeperDemo
             Console.WriteLine("    ✓ 连接 Zookeeper 成功");
 
             // 写入测试配置
-            cfg.Set("App:Name", "ZookeeperDemo");
-            cfg.Set("App:Version", "1.0.0");
-            cfg.Set("Database:Host", "localhost");
-            cfg.Set("Database:Port", "5432");
+            cfg.SetValue("App:Name", "ZookeeperDemo");
+            cfg.SetValue("App:Version", "1.0.0");
+            cfg.SetValue("Database:Host", "localhost");
+            cfg.SetValue("Database:Port", "5432");
             await cfg.SaveAsync();
             Console.WriteLine("    ✓ 写入配置成功");
 

+ 8 - 8
benchmarks/Apq.Cfg.Benchmarks/BatchOperationBenchmarks.cs

@@ -218,7 +218,7 @@ public class BatchOperationBenchmarks : IDisposable
         {
             values[$"Batch:Key{i}"] = $"Value{i}";
         }
-        _cfg.SetMany(values);
+        _cfg.SetManyValues(values);
     }
 
     /// <summary>
@@ -230,7 +230,7 @@ public class BatchOperationBenchmarks : IDisposable
     {
         for (int i = 0; i < 10; i++)
         {
-            _cfg.Set($"Loop:Key{i}", $"Value{i}");
+            _cfg.SetValue($"Loop:Key{i}", $"Value{i}");
         }
     }
 
@@ -246,7 +246,7 @@ public class BatchOperationBenchmarks : IDisposable
         {
             values[$"Batch50:Key{i}"] = $"Value{i}";
         }
-        _cfg.SetMany(values);
+        _cfg.SetManyValues(values);
     }
 
     /// <summary>
@@ -258,7 +258,7 @@ public class BatchOperationBenchmarks : IDisposable
     {
         for (int i = 0; i < 50; i++)
         {
-            _cfg.Set($"Loop50:Key{i}", $"Value{i}");
+            _cfg.SetValue($"Loop50:Key{i}", $"Value{i}");
         }
     }
 
@@ -274,7 +274,7 @@ public class BatchOperationBenchmarks : IDisposable
         {
             values[$"Batch100:Key{i}"] = $"Value{i}";
         }
-        _cfg.SetMany(values);
+        _cfg.SetManyValues(values);
     }
 
     /// <summary>
@@ -286,7 +286,7 @@ public class BatchOperationBenchmarks : IDisposable
     {
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set($"Loop100:Key{i}", $"Value{i}");
+            _cfg.SetValue($"Loop100:Key{i}", $"Value{i}");
         }
     }
 
@@ -310,7 +310,7 @@ public class BatchOperationBenchmarks : IDisposable
         {
             newValues[kv.Key + "_copy"] = kv.Value + "_modified";
         }
-        _cfg.SetMany(newValues);
+        _cfg.SetManyValues(newValues);
     }
 
     /// <summary>
@@ -330,7 +330,7 @@ public class BatchOperationBenchmarks : IDisposable
         // 循环写入
         foreach (var kv in values)
         {
-            _cfg.Set(kv.Key + "_copy2", kv.Value + "_modified");
+            _cfg.SetValue(kv.Key + "_copy2", kv.Value + "_modified");
         }
     }
 

+ 3 - 3
benchmarks/Apq.Cfg.Benchmarks/CacheBenchmarks.cs

@@ -263,7 +263,7 @@ public class CacheBenchmarks : IDisposable
     {
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set("Temp:Key", $"Value{i}");
+            _cfg.SetValue("Temp:Key", $"Value{i}");
             _ = _cfg.Get("Temp:Key");
         }
     }
@@ -277,7 +277,7 @@ public class CacheBenchmarks : IDisposable
     {
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set($"Temp:Key{i}", $"Value{i}");
+            _cfg.SetValue($"Temp:Key{i}", $"Value{i}");
             _ = _cfg.Get("HotKey");
         }
     }
@@ -292,7 +292,7 @@ public class CacheBenchmarks : IDisposable
         // 批量写入
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set($"Batch:Key{i}", $"Value{i}");
+            _cfg.SetValue($"Batch:Key{i}", $"Value{i}");
         }
 
         // 批量读取

+ 3 - 3
benchmarks/Apq.Cfg.Benchmarks/ConcurrencyBenchmarks.cs

@@ -291,7 +291,7 @@ public class ConcurrencyBenchmarks : IDisposable
             {
                 for (int j = 0; j < 100; j++)
                 {
-                    _cfg.Set($"Temp:Thread{threadId}:Key{j}", $"Value{j}");
+                    _cfg.SetValue($"Temp:Thread{threadId}:Key{j}", $"Value{j}");
                 }
             });
         }
@@ -321,7 +321,7 @@ public class ConcurrencyBenchmarks : IDisposable
                     }
                     else
                     {
-                        _cfg.Set($"Temp:Thread{threadId}:Key{j}", $"Value{j}");
+                        _cfg.SetValue($"Temp:Thread{threadId}:Key{j}", $"Value{j}");
                     }
                 }
             });
@@ -366,7 +366,7 @@ public class ConcurrencyBenchmarks : IDisposable
             {
                 for (int j = 0; j < 100; j++)
                 {
-                    _cfg.Set("Temp:SharedKey", $"Thread{threadId}_Value{j}");
+                    _cfg.SetValue("Temp:SharedKey", $"Thread{threadId}_Value{j}");
                 }
             });
         }

+ 3 - 3
benchmarks/Apq.Cfg.Benchmarks/KeyPathBenchmarks.cs

@@ -198,7 +198,7 @@ public class KeyPathBenchmarks : IDisposable
     [BenchmarkCategory("DeepWrite")]
     public void Set_DeepKey()
     {
-        _cfg.Set(_deepKey, "NewDeepValue");
+        _cfg.SetValue(_deepKey, "NewDeepValue");
     }
 
     /// <summary>
@@ -210,7 +210,7 @@ public class KeyPathBenchmarks : IDisposable
     {
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set(_deepKey, $"NewDeepValue{i}");
+            _cfg.SetValue(_deepKey, $"NewDeepValue{i}");
         }
     }
 
@@ -224,7 +224,7 @@ public class KeyPathBenchmarks : IDisposable
         for (int i = 0; i < 100; i++)
         {
             var newKey = _deepKey.Replace(":Value", $":NewKey{i}");
-            _cfg.Set(newKey, $"NewValue{i}");
+            _cfg.SetValue(newKey, $"NewValue{i}");
         }
     }
 

+ 2 - 2
benchmarks/Apq.Cfg.Benchmarks/MicrosoftConfigBenchmarks.cs

@@ -190,7 +190,7 @@ public class MicrosoftConfigBenchmarks : IDisposable
         using var subscription = _cfg.ConfigChanges.Subscribe(_ => changeCount++);
 
         // 触发变更
-        _cfg.Set("Temp:Key", "Value");
+        _cfg.SetValue("Temp:Key", "Value");
     }
 
     /// <summary>
@@ -210,7 +210,7 @@ public class MicrosoftConfigBenchmarks : IDisposable
             }
 
             // 触发变更
-            _cfg.Set("Temp:MultiKey", "Value");
+            _cfg.SetValue("Temp:MultiKey", "Value");
         }
         finally
         {

+ 2 - 2
benchmarks/Apq.Cfg.Benchmarks/MultiSourceBenchmarks.cs

@@ -176,7 +176,7 @@ public class MultiSourceBenchmarks : IDisposable
     {
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set($"NewData:Key{i}", $"Value{i}");
+            _cfg.SetValue($"NewData:Key{i}", $"Value{i}");
         }
     }
 
@@ -186,7 +186,7 @@ public class MultiSourceBenchmarks : IDisposable
     {
         for (int i = 0; i < 100; i++)
         {
-            _cfg.Set("Shared:Key", $"NewValue{i}");
+            _cfg.SetValue("Shared:Key", $"NewValue{i}");
         }
     }
 

+ 6 - 6
benchmarks/Apq.Cfg.Benchmarks/ReadWriteBenchmarks.cs

@@ -252,27 +252,27 @@ public class ReadWriteBenchmarks : IDisposable
 
     [Benchmark]
     [BenchmarkCategory("Set")]
-    public void Json_Set() => _jsonCfg.Set("App:TempKey", "TempValue");
+    public void Json_Set() => _jsonCfg.SetValue("App:TempKey", "TempValue");
 
     [Benchmark]
     [BenchmarkCategory("Set")]
-    public void Env_Set() => _envCfg.Set("APP_TEMPKEY", "TempValue");
+    public void Env_Set() => _envCfg.SetValue("APP_TEMPKEY", "TempValue");
 
     [Benchmark]
     [BenchmarkCategory("Set")]
-    public void Ini_Set() => _iniCfg.Set("App:TempKey", "TempValue");
+    public void Ini_Set() => _iniCfg.SetValue("App:TempKey", "TempValue");
 
     [Benchmark]
     [BenchmarkCategory("Set")]
-    public void Xml_Set() => _xmlCfg.Set("App:TempKey", "TempValue");
+    public void Xml_Set() => _xmlCfg.SetValue("App:TempKey", "TempValue");
 
     [Benchmark]
     [BenchmarkCategory("Set")]
-    public void Yaml_Set() => _yamlCfg.Set("App:TempKey", "TempValue");
+    public void Yaml_Set() => _yamlCfg.SetValue("App:TempKey", "TempValue");
 
     [Benchmark]
     [BenchmarkCategory("Set")]
-    public void Toml_Set() => _tomlCfg.Set("App:TempKey", "TempValue");
+    public void Toml_Set() => _tomlCfg.SetValue("App:TempKey", "TempValue");
 
     #endregion
 }

+ 9 - 9
benchmarks/Apq.Cfg.Benchmarks/SaveBenchmarks.cs

@@ -157,7 +157,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _jsonCfg.Set($"Data:Key{i}", $"Value{i}");
+            _jsonCfg.SetValue($"Data:Key{i}", $"Value{i}");
         }
         await _jsonCfg.SaveAsync();
     }
@@ -168,7 +168,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _iniCfg.Set($"Data:Key{i}", $"Value{i}");
+            _iniCfg.SetValue($"Data:Key{i}", $"Value{i}");
         }
         await _iniCfg.SaveAsync();
     }
@@ -179,7 +179,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _xmlCfg.Set($"Data:Key{i}", $"Value{i}");
+            _xmlCfg.SetValue($"Data:Key{i}", $"Value{i}");
         }
         await _xmlCfg.SaveAsync();
     }
@@ -190,7 +190,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _yamlCfg.Set($"Data:Key{i}", $"Value{i}");
+            _yamlCfg.SetValue($"Data:Key{i}", $"Value{i}");
         }
         await _yamlCfg.SaveAsync();
     }
@@ -201,7 +201,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _tomlCfg.Set($"Data:Key{i}", $"Value{i}");
+            _tomlCfg.SetValue($"Data:Key{i}", $"Value{i}");
         }
         await _tomlCfg.SaveAsync();
     }
@@ -217,7 +217,7 @@ public class SaveBenchmarks : IDisposable
         var largeValue = new string('X', 10000);
         for (int i = 0; i < ChangeCount / 10; i++)
         {
-            _jsonCfg.Set($"LargeData:Key{i}", largeValue);
+            _jsonCfg.SetValue($"LargeData:Key{i}", largeValue);
         }
         await _jsonCfg.SaveAsync();
     }
@@ -229,7 +229,7 @@ public class SaveBenchmarks : IDisposable
         var largeValue = new string('X', 10000);
         for (int i = 0; i < ChangeCount / 10; i++)
         {
-            _iniCfg.Set($"LargeData:Key{i}", largeValue);
+            _iniCfg.SetValue($"LargeData:Key{i}", largeValue);
         }
         await _iniCfg.SaveAsync();
     }
@@ -244,7 +244,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _jsonCfg.Set($"Frequent:Key{i}", $"Value{i}");
+            _jsonCfg.SetValue($"Frequent:Key{i}", $"Value{i}");
             if (i % 10 == 0)
             {
                 await _jsonCfg.SaveAsync();
@@ -259,7 +259,7 @@ public class SaveBenchmarks : IDisposable
     {
         for (int i = 0; i < ChangeCount; i++)
         {
-            _iniCfg.Set($"Frequent:Key{i}", $"Value{i}");
+            _iniCfg.SetValue($"Frequent:Key{i}", $"Value{i}");
             if (i % 10 == 0)
             {
                 await _iniCfg.SaveAsync();

+ 7 - 7
benchmarks/Apq.Cfg.Benchmarks/TypeConversionBenchmarks.cs

@@ -284,26 +284,26 @@ public class TypeConversionBenchmarks : IDisposable
 
     #endregion
 
-    #region TryGet 扩展方法
+    #region TryGetValue 扩展方法
 
     /// <summary>
-    /// TryGet 成功场景
+    /// TryGetValue 成功场景
     /// </summary>
     [Benchmark]
     [BenchmarkCategory("Extensions")]
-    public bool TryGet_Success()
+    public bool TryGetValue_Success()
     {
-        return _cfg.TryGet<int>("Types:Int", out _);
+        return _cfg.TryGetValue<int>("Types:Int", out _);
     }
 
     /// <summary>
-    /// TryGet 失败场景
+    /// TryGetValue 失败场景
     /// </summary>
     [Benchmark]
     [BenchmarkCategory("Extensions")]
-    public bool TryGet_Failure()
+    public bool TryGetValue_Failure()
     {
-        return _cfg.TryGet<int>("Types:NonExistent", out _);
+        return _cfg.TryGetValue<int>("Types:NonExistent", out _);
     }
 
     /// <summary>

+ 4 - 4
benchmarks/Apq.Cfg.Benchmarks/ZookeeperBenchmarks.cs

@@ -35,7 +35,7 @@ public class ZookeeperBenchmarks
             // 初始化测试数据
             for (int i = 0; i < 100; i++)
             {
-                _cfg.Set($"Key{i}", $"Value{i}");
+                _cfg.SetValue($"Key{i}", $"Value{i}");
             }
             _cfg.SaveAsync().GetAwaiter().GetResult();
 
@@ -78,7 +78,7 @@ public class ZookeeperBenchmarks
     public void Zookeeper_Set()
     {
         if (!_isZookeeperAvailable) return;
-        _cfg!.Set("BenchmarkKey", "BenchmarkValue");
+        _cfg!.SetValue("BenchmarkKey", "BenchmarkValue");
     }
 
     [Benchmark]
@@ -104,7 +104,7 @@ public class ZookeeperBenchmarks
         if (!_isZookeeperAvailable) return;
         for (int i = 0; i < 10; i++)
         {
-            _cfg!.Set($"BenchmarkKey{i}", $"Value{i}");
+            _cfg!.SetValue($"BenchmarkKey{i}", $"Value{i}");
         }
     }
 
@@ -112,7 +112,7 @@ public class ZookeeperBenchmarks
     public int Zookeeper_Get_Int()
     {
         if (!_isZookeeperAvailable) return 0;
-        _cfg!.Set("IntKey", "42");
+        _cfg!.SetValue("IntKey", "42");
         return _cfg.GetValue<int>("IntKey");
     }
 }

+ 1 - 1
benchmarks/README.md

@@ -220,7 +220,7 @@ dotnet run -c Release --project benchmarks/Apq.Cfg.Benchmarks -f net10.0 -- --li
 | ComplexTypes | Get_Guid, Get_DateTime, Get_Enum, Get_NullableInt |
 | Batch | Get_*_Multiple(批量转换) |
 | SpecialValues | Get_LongString, Get_Unicode, Get_SpecialChars, Get_EmptyString |
-| Extensions | TryGet_Success/Failure, GetRequired_Success, GetOrDefault_ExistingKey/NonExistingKey |
+| Extensions | TryGetValue_Success/Failure, GetRequired_Success, GetOrDefault_ExistingKey/NonExistingKey |
 | Mixed | Get_MixedTypes(混合类型读取) |
 
 ### 9. CacheBenchmarks - 缓存效果测试

+ 3 - 3
docs/site/api/extensions.md

@@ -213,17 +213,17 @@ public CfgBuilder ConfigureValueTransformer(Action<ValueTransformerOptions> conf
 
 ## ICfgRoot 扩展方法
 
-### TryGet
+### TryGetValue
 
 ```csharp
-public static bool TryGet<T>(this ICfgRoot root, string key, out T? value)
+public static bool TryGetValue<T>(this ICfgRoot root, string key, out T? value)
 ```
 
 尝试获取配置值。
 
 **示例:**
 ```csharp
-if (cfg.TryGet<int>("Database:Port", out var port))
+if (cfg.TryGetValue<int>("Database:Port", out var port))
 {
     Console.WriteLine($"端口: {port}");
 }

+ 3 - 3
docs/site/api/icfg-root.md

@@ -303,17 +303,17 @@ cfg.ConfigChanges.Subscribe(e =>
 
 ICfgRoot 还提供了一些便捷的扩展方法:
 
-### TryGet
+### TryGetValue
 
 ```csharp
-bool TryGet<T>(this ICfgRoot root, string key, out T? value)
+bool TryGetValue<T>(this ICfgRoot root, string key, out T? value)
 ```
 
 尝试获取配置值。
 
 **示例:**
 ```csharp
-if (cfg.TryGet<int>("Database:Port", out var port))
+if (cfg.TryGetValue<int>("Database:Port", out var port))
 {
     Console.WriteLine($"端口: {port}");
 }

+ 2 - 2
docs/site/en/guide/migration.md

@@ -74,7 +74,7 @@ var port = config.GetValue<int>("Server:Port", 8080);
 var port = cfg.GetOrDefault("Server:Port", 8080);
 ```
 
-### Safe Reading (TryGet)
+### Safe Reading (TryGetValue)
 
 ```csharp
 // Before
@@ -85,7 +85,7 @@ if (value != null)
 }
 
 // After
-if (cfg.TryGet<int>("Key", out var value))
+if (cfg.TryGetValue<int>("Key", out var value))
 {
     // use value
 }

+ 1 - 1
docs/site/guide/basic-usage.md

@@ -93,7 +93,7 @@ var timeout = cfg.GetOrDefault<int>("Database:Timeout", defaultValue: 30);
 var connectionString = cfg.GetRequired<string>("Database:ConnectionString");
 
 // 尝试获取
-if (cfg.TryGet<int>("Database:Port", out var port))
+if (cfg.TryGetValue<int>("Database:Port", out var port))
 {
     Console.WriteLine($"端口: {port}");
 }

+ 2 - 2
docs/site/guide/migration.md

@@ -74,7 +74,7 @@ var port = config.GetValue<int>("Server:Port", 8080);
 var port = cfg.GetOrDefault("Server:Port", 8080);
 ```
 
-### 安全读取(TryGet)
+### 安全读取(TryGetValue
 
 ```csharp
 // 之前
@@ -85,7 +85,7 @@ if (value != null)
 }
 
 // 之后
-if (cfg.TryGet<int>("Key", out var value))
+if (cfg.TryGetValue<int>("Key", out var value))
 {
     // 使用 value
 }

+ 1 - 1
docs/单元测试覆盖分析报告.md

@@ -131,7 +131,7 @@
 
 | API | 测试覆盖 | 测试文件 |
 |-----|----------|----------|
-| `TryGet<T>()` | ✅ | CfgRootExtensionsTests |
+| `TryGetValue<T>()` | ✅ | CfgRootExtensionsTests |
 | `GetRequired<T>()` | ✅ | CfgRootExtensionsTests |
 | `GetOrDefault<T>()` | ✅ | CfgSectionTests |
 

+ 3 - 3
tests/Apq.Cfg.Tests.Shared/BoundaryConditionTests.cs

@@ -66,7 +66,7 @@ public class BoundaryConditionTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("EmptyValue", "");
+        cfg.SetValue("EmptyValue", "");
 
         // Assert
         Assert.Equal("", cfg.Get("EmptyValue"));
@@ -84,7 +84,7 @@ public class BoundaryConditionTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("NullValue", null);
+        cfg.SetValue("NullValue", null);
 
         // Assert
         Assert.Null(cfg.Get("NullValue"));
@@ -296,7 +296,7 @@ public class BoundaryConditionTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("LongKey", longValue);
+        cfg.SetValue("LongKey", longValue);
         await cfg.SaveAsync();
 
         // Assert

+ 10 - 10
tests/Apq.Cfg.Tests.Shared/CfgBuilderAdvancedTests.cs

@@ -91,7 +91,7 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act - 写入到 level 0
-        cfg.Set("NewKey", "Level0Value", targetLevel: 0);
+        cfg.SetValue("NewKey", "Level0Value", targetLevel: 0);
         await cfg.SaveAsync(targetLevel: 0);
 
         // Assert - 验证写入到了正确的文件
@@ -146,8 +146,8 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act - 在两个层级都设置值,但只保存 level 1
-        cfg.Set("Level0Key", "Value0", targetLevel: 0);
-        cfg.Set("Level1Key", "Value1", targetLevel: 1);
+        cfg.SetValue("Level0Key", "Value0", targetLevel: 0);
+        cfg.SetValue("Level1Key", "Value1", targetLevel: 1);
         await cfg.SaveAsync(targetLevel: 1);
 
         // Assert - level 1 应该保存了,level 0 不应该保存
@@ -178,7 +178,7 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act - 不指定 targetLevel,应该写入最高层级
-        cfg.Set("NewKey", "NewValue");
+        cfg.SetValue("NewKey", "NewValue");
 
         // Assert - 通过 Get 验证值已设置(在 Pending 中)
         Assert.Equal("NewValue", cfg.Get("NewKey"));
@@ -232,7 +232,7 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act & Assert
-        var ex = Assert.Throws<InvalidOperationException>(() => cfg.Set("NewKey", "NewValue"));
+        var ex = Assert.Throws<InvalidOperationException>(() => cfg.SetValue("NewKey", "NewValue"));
         Assert.Contains("没有可写的配置源", ex.Message);
     }
 
@@ -264,7 +264,7 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act & Assert - 指定不存在的层级
-        var ex = Assert.Throws<InvalidOperationException>(() => cfg.Set("NewKey", "NewValue", targetLevel: 999));
+        var ex = Assert.Throws<InvalidOperationException>(() => cfg.SetValue("NewKey", "NewValue", targetLevel: 999));
         Assert.Contains("没有可写的配置源", ex.Message);
     }
 
@@ -394,7 +394,7 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("Database:Password", "MySecretPassword");
+        cfg.SetValue("Database:Password", "MySecretPassword");
         await cfg.SaveAsync();
 
         // Assert - 文件中应该是加密后的值
@@ -524,8 +524,8 @@ public class CfgBuilderAdvancedTests : IDisposable
             .Build();
 
         // Act - 设置自定义敏感键
-        cfg.Set("MyCustomSecret", "SecretValue");
-        cfg.Set("NormalKey", "NormalValue");
+        cfg.SetValue("MyCustomSecret", "SecretValue");
+        cfg.SetValue("NormalKey", "NormalValue");
 
         // Assert - 自定义敏感键应该被加密处理
         // 注意:这里只验证配置生效,实际加密在 SaveAsync 时发生
@@ -585,7 +585,7 @@ public class CfgBuilderAdvancedTests : IDisposable
             .AddJson(jsonPath, level: 0, writeable: true, isPrimaryWriter: true)
             .Build();
 
-        cfg.Set("Key", "Value");
+        cfg.SetValue("Key", "Value");
 
         // Assert - 配置应该正常工作
         Assert.Equal("Value", cfg.Get("Key"));

+ 6 - 6
tests/Apq.Cfg.Tests.Shared/CfgRootExtensionsTests.cs

@@ -24,7 +24,7 @@ public class CfgRootExtensionsTests : IDisposable
     }
 
     [Fact]
-    public void TryGet_ExistingKey_ReturnsTrueAndValue()
+    public void TryGetValue_ExistingKey_ReturnsTrueAndValue()
     {
         // Arrange
         var jsonPath = Path.Combine(_testDir, "config.json");
@@ -35,15 +35,15 @@ public class CfgRootExtensionsTests : IDisposable
             .Build();
 
         // Act & Assert
-        Assert.True(cfg.TryGet<int>("IntValue", out var intValue));
+        Assert.True(cfg.TryGetValue<int>("IntValue", out var intValue));
         Assert.Equal(42, intValue);
 
-        Assert.True(cfg.TryGet<string>("StringValue", out var stringValue));
+        Assert.True(cfg.TryGetValue<string>("StringValue", out var stringValue));
         Assert.Equal("Hello", stringValue);
     }
 
     [Fact]
-    public void TryGet_NonExistingKey_ReturnsFalseAndDefault()
+    public void TryGetValue_NonExistingKey_ReturnsFalseAndDefault()
     {
         // Arrange
         var jsonPath = Path.Combine(_testDir, "config.json");
@@ -54,10 +54,10 @@ public class CfgRootExtensionsTests : IDisposable
             .Build();
 
         // Act & Assert
-        Assert.False(cfg.TryGet<int>("NonExistent", out var intValue));
+        Assert.False(cfg.TryGetValue<int>("NonExistent", out var intValue));
         Assert.Equal(default, intValue);
 
-        Assert.False(cfg.TryGet<string>("NonExistent", out var stringValue));
+        Assert.False(cfg.TryGetValue<string>("NonExistent", out var stringValue));
         Assert.Null(stringValue);
     }
 

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/CfgSectionTests.cs

@@ -169,7 +169,7 @@ public class CfgSectionTests : IDisposable
 
         // Act
         var section = cfg.GetSection("App");
-        section.Set("Name", "NewName");
+        section.SetValue("Name", "NewName");
         await cfg.SaveAsync();
 
         // Assert

+ 5 - 5
tests/Apq.Cfg.Tests.Shared/ConcurrencyTests.cs

@@ -99,7 +99,7 @@ public class ConcurrencyTests : IDisposable
                 {
                     for (int j = 0; j < 20; j++)
                     {
-                        cfg.Set($"Key_{index}_{j}", $"Value_{index}_{j}");
+                        cfg.SetValue($"Key_{index}_{j}", $"Value_{index}_{j}");
                     }
                 }
                 catch (Exception ex)
@@ -166,7 +166,7 @@ public class ConcurrencyTests : IDisposable
                 {
                     for (int j = 0; j < 50 && !cts.Token.IsCancellationRequested; j++)
                     {
-                        cfg.Set($"Dynamic_{index}", $"Value_{j}");
+                        cfg.SetValue($"Dynamic_{index}", $"Value_{j}");
                     }
                 }
                 catch (OperationCanceledException) { }
@@ -200,7 +200,7 @@ public class ConcurrencyTests : IDisposable
         // 先设置一些值
         for (int i = 0; i < 10; i++)
         {
-            cfg.Set($"Key_{i}", $"Value_{i}");
+            cfg.SetValue($"Key_{i}", $"Value_{i}");
         }
 
         // Act - 顺序保存(并发保存文件会导致文件锁冲突,这是预期行为)
@@ -356,8 +356,8 @@ public class ConcurrencyTests : IDisposable
                         var ___ = cfg.Get("OverrideOnly");
 
                         // 写入到不同层级
-                        cfg.Set($"Level0Key_{index}_{j}", $"Value", targetLevel: 0);
-                        cfg.Set($"Level1Key_{index}_{j}", $"Value", targetLevel: 1);
+                        cfg.SetValue($"Level0Key_{index}_{j}", $"Value", targetLevel: 0);
+                        cfg.SetValue($"Level1Key_{index}_{j}", $"Value", targetLevel: 1);
                     }
                 }
                 catch (Exception ex)

+ 9 - 9
tests/Apq.Cfg.Tests.Shared/ConsulCfgTests.cs

@@ -63,7 +63,7 @@ public class ConsulCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsConsulConfigured, "Consul 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("TestKey", "TestValue");
+        _cfg!.SetValue("TestKey", "TestValue");
         await _cfg.SaveAsync();
 
         // 重新创建配置实例来验证持久化
@@ -87,8 +87,8 @@ public class ConsulCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsConsulConfigured, "Consul 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("Settings:Value1", "Value1");
-        _cfg.Set("Settings:Value2", "Value2");
+        _cfg!.SetValue("Settings:Value1", "Value1");
+        _cfg.SetValue("Settings:Value2", "Value2");
         await _cfg.SaveAsync();
 
         // Assert
@@ -112,7 +112,7 @@ public class ConsulCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsConsulConfigured, "Consul 服务未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ToRemove", "Value");
+        _cfg!.SetValue("ToRemove", "Value");
         await _cfg.SaveAsync();
 
         // Act
@@ -139,7 +139,7 @@ public class ConsulCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsConsulConfigured, "Consul 服务未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ExistsKey", "Value");
+        _cfg!.SetValue("ExistsKey", "Value");
         await _cfg.SaveAsync();
 
         // Assert
@@ -162,7 +162,7 @@ public class ConsulCfgTests : IAsyncLifetime
             File.WriteAllText(jsonPath, """{"Setting": "JsonValue"}""");
 
             // 先设置 Consul 值
-            _cfg!.Set("Setting", "ConsulValue");
+            _cfg!.SetValue("Setting", "ConsulValue");
             _cfg.SaveAsync().Wait();
 
             using var cfg = new CfgBuilder()
@@ -191,9 +191,9 @@ public class ConsulCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsConsulConfigured, "Consul 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("IntValue", "42");
-        _cfg.Set("BoolValue", "true");
-        _cfg.Set("DoubleValue", "3.14");
+        _cfg!.SetValue("IntValue", "42");
+        _cfg.SetValue("BoolValue", "true");
+        _cfg.SetValue("DoubleValue", "3.14");
         await _cfg.SaveAsync();
 
         // Assert

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/CryptoTests.cs

@@ -455,7 +455,7 @@ public class CryptoTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("Database:Password", "MyNewPassword");
+        cfg.SetValue("Database:Password", "MyNewPassword");
         await cfg.SaveAsync();
 
         // Assert - 读取原始文件验证已加密

+ 6 - 6
tests/Apq.Cfg.Tests.Shared/DatabaseCfgTests.cs

@@ -65,7 +65,7 @@ public class DatabaseCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsDatabaseConfigured, "数据库连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("TestKey", "TestValue");
+        _cfg!.SetValue("TestKey", "TestValue");
         await _cfg.SaveAsync();
 
         // 重新创建配置实例来验证持久化
@@ -90,8 +90,8 @@ public class DatabaseCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsDatabaseConfigured, "数据库连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("Settings:Value1", "Value1");
-        _cfg.Set("Settings:Value2", "Value2");
+        _cfg!.SetValue("Settings:Value1", "Value1");
+        _cfg.SetValue("Settings:Value2", "Value2");
         await _cfg.SaveAsync();
 
         // Assert
@@ -116,7 +116,7 @@ public class DatabaseCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsDatabaseConfigured, "数据库连接字符串未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ToRemove", "Value");
+        _cfg!.SetValue("ToRemove", "Value");
         await _cfg.SaveAsync();
 
         // Act
@@ -144,7 +144,7 @@ public class DatabaseCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsDatabaseConfigured, "数据库连接字符串未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ExistsKey", "Value");
+        _cfg!.SetValue("ExistsKey", "Value");
         await _cfg.SaveAsync();
 
         // Assert
@@ -167,7 +167,7 @@ public class DatabaseCfgTests : IAsyncLifetime
             File.WriteAllText(jsonPath, """{"Setting": "JsonValue"}""");
 
             // 先设置数据库值
-            _cfg!.Set("Setting", "DatabaseValue");
+            _cfg!.SetValue("Setting", "DatabaseValue");
             _cfg.SaveAsync().Wait();
 
             using var cfg = new CfgBuilder()

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/EncodingTests.cs

@@ -346,7 +346,7 @@ public class EncodingTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("Key", "Value");
+        cfg.SetValue("Key", "Value");
         await cfg.SaveAsync();
 
         // Assert - 检查文件是否有 BOM

+ 5 - 5
tests/Apq.Cfg.Tests.Shared/EnvCfgTests.cs

@@ -180,7 +180,7 @@ public class EnvCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("NEW_KEY", "NewValue");
+        cfg.SetValue("NEW_KEY", "NewValue");
         await cfg.SaveAsync();
 
         // Assert
@@ -204,8 +204,8 @@ public class EnvCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("DATABASE:HOST", "localhost");
-        cfg.Set("DATABASE:PORT", "5432");
+        cfg.SetValue("DATABASE:HOST", "localhost");
+        cfg.SetValue("DATABASE:PORT", "5432");
         await cfg.SaveAsync();
 
         // Assert - 读取文件内容验证格式
@@ -304,8 +304,8 @@ public class EnvCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("MESSAGE", "Hello World");  // 包含空格
-        cfg.Set("COMMENT", "Value # with hash");  // 包含 #
+        cfg.SetValue("MESSAGE", "Hello World");  // 包含空格
+        cfg.SetValue("COMMENT", "Value # with hash");  // 包含 #
         await cfg.SaveAsync();
 
         // Assert

+ 9 - 9
tests/Apq.Cfg.Tests.Shared/EtcdCfgTests.cs

@@ -64,7 +64,7 @@ public class EtcdCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsEtcdConfigured, "Etcd 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("TestKey", "TestValue");
+        _cfg!.SetValue("TestKey", "TestValue");
         await _cfg.SaveAsync();
 
         // 重新创建配置实例来验证持久化
@@ -89,8 +89,8 @@ public class EtcdCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsEtcdConfigured, "Etcd 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("Settings:Value1", "Value1");
-        _cfg.Set("Settings:Value2", "Value2");
+        _cfg!.SetValue("Settings:Value1", "Value1");
+        _cfg.SetValue("Settings:Value2", "Value2");
         await _cfg.SaveAsync();
 
         // Assert
@@ -115,7 +115,7 @@ public class EtcdCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsEtcdConfigured, "Etcd 服务未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ToRemove", "Value");
+        _cfg!.SetValue("ToRemove", "Value");
         await _cfg.SaveAsync();
 
         // Act
@@ -143,7 +143,7 @@ public class EtcdCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsEtcdConfigured, "Etcd 服务未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ExistsKey", "Value");
+        _cfg!.SetValue("ExistsKey", "Value");
         await _cfg.SaveAsync();
 
         // Assert
@@ -166,7 +166,7 @@ public class EtcdCfgTests : IAsyncLifetime
             File.WriteAllText(jsonPath, """{"Setting": "JsonValue"}""");
 
             // 先设置 Etcd 值
-            _cfg!.Set("Setting", "EtcdValue");
+            _cfg!.SetValue("Setting", "EtcdValue");
             _cfg.SaveAsync().Wait();
 
             using var cfg = new CfgBuilder()
@@ -196,9 +196,9 @@ public class EtcdCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsEtcdConfigured, "Etcd 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("IntValue", "42");
-        _cfg.Set("BoolValue", "true");
-        _cfg.Set("DoubleValue", "3.14");
+        _cfg!.SetValue("IntValue", "42");
+        _cfg.SetValue("BoolValue", "true");
+        _cfg.SetValue("DoubleValue", "3.14");
         await _cfg.SaveAsync();
 
         // Assert

+ 7 - 7
tests/Apq.Cfg.Tests.Shared/ExceptionHandlingTests.cs

@@ -72,7 +72,7 @@ public class ExceptionHandlingTests : IDisposable
             .Build();
 
         // Act & Assert
-        var ex = Assert.Throws<InvalidOperationException>(() => cfg.Set("NewKey", "NewValue"));
+        var ex = Assert.Throws<InvalidOperationException>(() => cfg.SetValue("NewKey", "NewValue"));
         Assert.Contains("没有可写的配置源", ex.Message);
     }
 
@@ -104,7 +104,7 @@ public class ExceptionHandlingTests : IDisposable
             .Build();
 
         // Act & Assert - 指定不存在的层级
-        var ex = Assert.Throws<InvalidOperationException>(() => cfg.Set("Key", "Value", targetLevel: 999));
+        var ex = Assert.Throws<InvalidOperationException>(() => cfg.SetValue("Key", "Value", targetLevel: 999));
         Assert.Contains("没有可写的配置源", ex.Message);
     }
 
@@ -212,7 +212,7 @@ public class ExceptionHandlingTests : IDisposable
                 .AddJson(jsonPath, level: 0, writeable: true, isPrimaryWriter: true)
                 .Build();
 
-            cfg.Set("NewKey", "NewValue");
+            cfg.SetValue("NewKey", "NewValue");
 
             // Act & Assert - 保存到只读文件应该抛出异常
             var exception = await Assert.ThrowsAnyAsync<Exception>(async () => await cfg.SaveAsync());
@@ -268,7 +268,7 @@ public class ExceptionHandlingTests : IDisposable
             .AddJson(jsonPath, level: 0, writeable: true, isPrimaryWriter: true)
             .Build();
 
-        cfg.Set("NewKey", "NewValue");
+        cfg.SetValue("NewKey", "NewValue");
         cfg.Dispose();
 
         // Act & Assert
@@ -323,7 +323,7 @@ public class ExceptionHandlingTests : IDisposable
             .Build();
 
         // Assert - 应该使用最后一个
-        cfg.Set("NewKey", "NewValue");
+        cfg.SetValue("NewKey", "NewValue");
         Assert.Equal("NewValue", cfg.Get("NewKey"));
     }
 
@@ -343,7 +343,7 @@ public class ExceptionHandlingTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("NewKey", "NewValue");
+        cfg.SetValue("NewKey", "NewValue");
         await cfg.SaveAsync();
 
         // Assert - 验证写入到了正确的文件(最后一个 PrimaryWriter)
@@ -366,7 +366,7 @@ public class ExceptionHandlingTests : IDisposable
             .AddJson(jsonPath, level: 0, writeable: true, isPrimaryWriter: true)
             .Build();
 
-        cfg.Set("NewKey", "NewValue");
+        cfg.SetValue("NewKey", "NewValue");
 
         var cts = new CancellationTokenSource();
         cts.Cancel();

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/IniCfgTests.cs

@@ -82,7 +82,7 @@ public class IniCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("App:NewKey", "NewValue");
+        cfg.SetValue("App:NewKey", "NewValue");
         await cfg.SaveAsync();
 
         // Assert

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/JsonCfgTests.cs

@@ -118,7 +118,7 @@ public class JsonCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("NewKey", "NewValue");
+        cfg.SetValue("NewKey", "NewValue");
         await cfg.SaveAsync();
 
         // Assert - 重新读取验证

+ 28 - 28
tests/Apq.Cfg.Tests.Shared/PerformanceOptimizationTests.cs

@@ -111,8 +111,8 @@ public class PerformanceOptimizationTests : IDisposable
             .AddJson(jsonPath, level: 0, writeable: true)
             .Build();
 
-        cfg.Set("Key1", "Modified");
-        cfg.Set("Key2", "NewValue");
+        cfg.SetValue("Key1", "Modified");
+        cfg.SetValue("Key2", "NewValue");
 
         // Act
         var result = cfg.GetMany(new[] { "Key1", "Key2" });
@@ -134,7 +134,7 @@ public class PerformanceOptimizationTests : IDisposable
             .Build();
 
         // Act
-        cfg.SetMany(new Dictionary<string, string?>
+        cfg.SetManyValues(new Dictionary<string, string?>
         {
             ["Key1"] = "Value1",
             ["Key2"] = "Value2",
@@ -159,7 +159,7 @@ public class PerformanceOptimizationTests : IDisposable
             .Build();
 
         // Act
-        cfg.SetMany(new Dictionary<string, string?>
+        cfg.SetManyValues(new Dictionary<string, string?>
         {
             ["Key1"] = "Value1",
             ["Key2"] = "Value2"
@@ -244,8 +244,8 @@ public class PerformanceOptimizationTests : IDisposable
             .AddJson(jsonPath, level: 0, writeable: true)
             .Build();
 
-        cfg.Set("Key1", "Modified");
-        cfg.Set("Key2", "NewValue");
+        cfg.SetValue("Key1", "Modified");
+        cfg.SetValue("Key2", "NewValue");
 
         var results = new Dictionary<string, string?>();
 
@@ -357,8 +357,8 @@ public class PerformanceOptimizationTests : IDisposable
             .AddJson(jsonPath, level: 0, writeable: true)
             .Build();
 
-        cfg.Set("Int1", "20");
-        cfg.Set("Int2", "30");
+        cfg.SetValue("Int1", "20");
+        cfg.SetValue("Int2", "30");
 
         var results = new Dictionary<string, int?>();
 
@@ -493,25 +493,25 @@ public class PerformanceOptimizationTests : IDisposable
         var cache = new ValueCache();
 
         // Act
-        cache.Set("Key1", 42);
-        cache.Set("Key2", "StringValue");
+        cache.SetValue("Key1", 42);
+        cache.SetValue("Key2", "StringValue");
 
         // Assert
-        Assert.True(cache.TryGet<int>("Key1", out var intValue));
+        Assert.True(cache.TryGetValue<int>("Key1", out var intValue));
         Assert.Equal(42, intValue);
 
-        Assert.True(cache.TryGet<string>("Key2", out var stringValue));
+        Assert.True(cache.TryGetValue<string>("Key2", out var stringValue));
         Assert.Equal("StringValue", stringValue);
     }
 
     [Fact]
-    public void ValueCache_TryGet_ReturnsFalseForMissingKey()
+    public void ValueCache_TryGetValue_ReturnsFalseForMissingKey()
     {
         // Arrange
         var cache = new ValueCache();
 
         // Act & Assert
-        Assert.False(cache.TryGet<int>("NonExistent", out _));
+        Assert.False(cache.TryGetValue<int>("NonExistent", out _));
     }
 
     [Fact]
@@ -521,14 +521,14 @@ public class PerformanceOptimizationTests : IDisposable
         var cache = new ValueCache();
 
         // Act
-        cache.Set<int>("Key", 42);
-        cache.Set<string>("Key", "42");
+        cache.SetValue<int>("Key", 42);
+        cache.SetValue<string>("Key", "42");
 
         // Assert
-        Assert.True(cache.TryGet<int>("Key", out var intValue));
+        Assert.True(cache.TryGetValue<int>("Key", out var intValue));
         Assert.Equal(42, intValue);
 
-        Assert.True(cache.TryGet<string>("Key", out var stringValue));
+        Assert.True(cache.TryGetValue<string>("Key", out var stringValue));
         Assert.Equal("42", stringValue);
     }
 
@@ -537,15 +537,15 @@ public class PerformanceOptimizationTests : IDisposable
     {
         // Arrange
         var cache = new ValueCache();
-        cache.Set("Key1", 42);
-        cache.Set("Key2", 100);
+        cache.SetValue("Key1", 42);
+        cache.SetValue("Key2", 100);
 
         // Act
         cache.Invalidate("Key1");
 
         // Assert
-        Assert.False(cache.TryGet<int>("Key1", out _));
-        Assert.True(cache.TryGet<int>("Key2", out _));
+        Assert.False(cache.TryGetValue<int>("Key1", out _));
+        Assert.True(cache.TryGetValue<int>("Key2", out _));
     }
 
     [Fact]
@@ -553,15 +553,15 @@ public class PerformanceOptimizationTests : IDisposable
     {
         // Arrange
         var cache = new ValueCache();
-        cache.Set("Key1", 42);
-        cache.Set("Key2", 100);
+        cache.SetValue("Key1", 42);
+        cache.SetValue("Key2", 100);
 
         // Act
         cache.Clear();
 
         // Assert
-        Assert.False(cache.TryGet<int>("Key1", out _));
-        Assert.False(cache.TryGet<int>("Key2", out _));
+        Assert.False(cache.TryGetValue<int>("Key1", out _));
+        Assert.False(cache.TryGetValue<int>("Key2", out _));
     }
 
     [Fact]
@@ -572,14 +572,14 @@ public class PerformanceOptimizationTests : IDisposable
         var initialVersion = cache.Version;
 
         // Act
-        cache.Set("Key", 42);
+        cache.SetValue("Key", 42);
         var afterSetVersion = cache.Version;
 
         cache.Invalidate("Key");
         var afterInvalidateVersion = cache.Version;
 
         // Assert
-        Assert.Equal(initialVersion, afterSetVersion); // Set 不改变版本
+        Assert.Equal(initialVersion, afterSetVersion); // SetValue 不改变版本
         Assert.Equal(initialVersion + 1, afterInvalidateVersion); // Invalidate 增加版本
     }
 

+ 6 - 6
tests/Apq.Cfg.Tests.Shared/RedisCfgTests.cs

@@ -61,7 +61,7 @@ public class RedisCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsRedisConfigured, "Redis 连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("TestKey", "TestValue");
+        _cfg!.SetValue("TestKey", "TestValue");
         await _cfg.SaveAsync();
 
         // 重新创建配置实例来验证持久化
@@ -83,8 +83,8 @@ public class RedisCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsRedisConfigured, "Redis 连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("Settings:Value1", "Value1");
-        _cfg.Set("Settings:Value2", "Value2");
+        _cfg!.SetValue("Settings:Value1", "Value1");
+        _cfg.SetValue("Settings:Value2", "Value2");
         await _cfg.SaveAsync();
 
         // Assert
@@ -106,7 +106,7 @@ public class RedisCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsRedisConfigured, "Redis 连接字符串未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ToRemove", "Value");
+        _cfg!.SetValue("ToRemove", "Value");
         await _cfg.SaveAsync();
 
         // Act
@@ -131,7 +131,7 @@ public class RedisCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsRedisConfigured, "Redis 连接字符串未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ExistsKey", "Value");
+        _cfg!.SetValue("ExistsKey", "Value");
         await _cfg.SaveAsync();
 
         // Assert
@@ -154,7 +154,7 @@ public class RedisCfgTests : IAsyncLifetime
             File.WriteAllText(jsonPath, """{"Setting": "JsonValue"}""");
 
             // 先设置 Redis 值
-            _cfg!.Set("Setting", "RedisValue");
+            _cfg!.SetValue("Setting", "RedisValue");
             _cfg.SaveAsync().Wait();
 
             using var cfg = new CfgBuilder()

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/TomlCfgTests.cs

@@ -84,7 +84,7 @@ public class TomlCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("App:NewKey", "NewValue");
+        cfg.SetValue("App:NewKey", "NewValue");
         await cfg.SaveAsync();
 
         // Assert

+ 9 - 9
tests/Apq.Cfg.Tests.Shared/VaultCfgTests.cs

@@ -65,7 +65,7 @@ public class VaultCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsVaultConfigured, "Vault 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("TestKey", "TestValue");
+        _cfg!.SetValue("TestKey", "TestValue");
         await _cfg.SaveAsync();
 
         // 重新创建配置实例来验证持久化
@@ -91,8 +91,8 @@ public class VaultCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsVaultConfigured, "Vault 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("Settings:Value1", "Value1");
-        _cfg.Set("Settings:Value2", "Value2");
+        _cfg!.SetValue("Settings:Value1", "Value1");
+        _cfg.SetValue("Settings:Value2", "Value2");
         await _cfg.SaveAsync();
 
         // Assert
@@ -118,7 +118,7 @@ public class VaultCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsVaultConfigured, "Vault 服务未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ToRemove", "Value");
+        _cfg!.SetValue("ToRemove", "Value");
         await _cfg.SaveAsync();
 
         // Act
@@ -147,7 +147,7 @@ public class VaultCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsVaultConfigured, "Vault 服务未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ExistsKey", "Value");
+        _cfg!.SetValue("ExistsKey", "Value");
         await _cfg.SaveAsync();
 
         // Assert
@@ -170,7 +170,7 @@ public class VaultCfgTests : IAsyncLifetime
             File.WriteAllText(jsonPath, """{"Setting": "JsonValue"}""");
 
             // 先设置 Vault 值
-            _cfg!.Set("Setting", "VaultValue");
+            _cfg!.SetValue("Setting", "VaultValue");
             _cfg.SaveAsync().Wait();
 
             using var cfg = new CfgBuilder()
@@ -201,9 +201,9 @@ public class VaultCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsVaultConfigured, "Vault 服务未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("IntValue", "42");
-        _cfg.Set("BoolValue", "true");
-        _cfg.Set("DoubleValue", "3.14");
+        _cfg!.SetValue("IntValue", "42");
+        _cfg.SetValue("BoolValue", "true");
+        _cfg.SetValue("DoubleValue", "3.14");
         await _cfg.SaveAsync();
 
         // Assert

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/XmlCfgTests.cs

@@ -94,7 +94,7 @@ public class XmlCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("App:NewKey", "NewValue");
+        cfg.SetValue("App:NewKey", "NewValue");
         await cfg.SaveAsync();
 
         // Assert

+ 1 - 1
tests/Apq.Cfg.Tests.Shared/YamlCfgTests.cs

@@ -83,7 +83,7 @@ public class YamlCfgTests : IDisposable
             .Build();
 
         // Act
-        cfg.Set("App:NewKey", "NewValue");
+        cfg.SetValue("App:NewKey", "NewValue");
         await cfg.SaveAsync();
 
         // Assert

+ 9 - 9
tests/Apq.Cfg.Tests.Shared/ZookeeperCfgTests.cs

@@ -62,7 +62,7 @@ public class ZookeeperCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsZookeeperConfigured, "Zookeeper 连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("TestKey", "TestValue");
+        _cfg!.SetValue("TestKey", "TestValue");
         await _cfg.SaveAsync();
 
         // 重新创建配置实例来验证持久化
@@ -85,8 +85,8 @@ public class ZookeeperCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsZookeeperConfigured, "Zookeeper 连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("Settings:Value1", "Value1");
-        _cfg.Set("Settings:Value2", "Value2");
+        _cfg!.SetValue("Settings:Value1", "Value1");
+        _cfg.SetValue("Settings:Value2", "Value2");
         await _cfg.SaveAsync();
 
         // Assert
@@ -109,7 +109,7 @@ public class ZookeeperCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsZookeeperConfigured, "Zookeeper 连接字符串未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ToRemove", "Value");
+        _cfg!.SetValue("ToRemove", "Value");
         await _cfg.SaveAsync();
 
         // Act
@@ -135,7 +135,7 @@ public class ZookeeperCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsZookeeperConfigured, "Zookeeper 连接字符串未配置,跳过测试");
 
         // Arrange
-        _cfg!.Set("ExistsKey", "Value");
+        _cfg!.SetValue("ExistsKey", "Value");
         await _cfg.SaveAsync();
 
         // Assert
@@ -158,7 +158,7 @@ public class ZookeeperCfgTests : IAsyncLifetime
             File.WriteAllText(jsonPath, """{"Setting": "JsonValue"}""");
 
             // 先设置 Zookeeper 值
-            _cfg!.Set("Setting", "ZookeeperValue");
+            _cfg!.SetValue("Setting", "ZookeeperValue");
             _cfg.SaveAsync().Wait();
 
             using var cfg = new CfgBuilder()
@@ -186,9 +186,9 @@ public class ZookeeperCfgTests : IAsyncLifetime
         Skip.If(!TestSettings.IsZookeeperConfigured, "Zookeeper 连接字符串未配置,跳过测试");
 
         // Arrange & Act
-        _cfg!.Set("IntValue", "42");
-        _cfg.Set("BoolValue", "true");
-        _cfg.Set("DoubleValue", "3.14");
+        _cfg!.SetValue("IntValue", "42");
+        _cfg.SetValue("BoolValue", "true");
+        _cfg.SetValue("DoubleValue", "3.14");
         await _cfg.SaveAsync();
 
         // Assert

+ 2 - 2
tests/README.md

@@ -49,7 +49,7 @@ dotnet test --filter "FullyQualifiedName~JsonCfgTests"
 | EtcdCfgTests | 6 | 6 | Etcd 配置中心测试(需要 Etcd 服务)|
 | NacosCfgTests | 9 | 9 | Nacos 配置中心测试(需要 Nacos 服务)|
 | VaultCfgTests | 8 | 8 | Vault 密钥管理测试(需要 Vault 服务)|
-| CfgRootExtensionsTests | 11 | 0 | 扩展方法测试(TryGet/GetRequired/GetMasked/GetMaskedSnapshot)|
+| CfgRootExtensionsTests | 11 | 0 | 扩展方法测试(TryGetValue/GetRequired/GetMasked/GetMaskedSnapshot)|
 | CfgBuilderAdvancedTests | 28 | 0 | 高级功能测试(编码映射/值转换器/脱敏器/编码检测日志)|
 | DynamicReloadTests | 22 | 0 | 动态配置重载测试 |
 | EncodingDetectionTests | 14 | 0 | 编码检测测试 |
@@ -143,7 +143,7 @@ dotnet test --filter "FullyQualifiedName~JsonCfgTests"
 | `WithEncodingDetectionLogging()` | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
 | `Build()` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
 | **CfgRootExtensions** |
-| `TryGet<T>()` | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
+| `TryGetValue<T>()` | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
 | `GetRequired<T>()` | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
 | `GetOrDefault<T>()` | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
 | `GetMasked()` | ✅ | - | - | - | - | - | - | - | - | - | - | - | - | - | - |