From a53898dd43d84bef1d02594b2e43fa4fc272db7f Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:34:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(rule):=20=E6=B7=BB=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E6=8F=90=E4=BE=9B=E8=80=85=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 ResetContextProvider 方法用于重置上下文提供者为默认值 - 为方法添加 XML 文档注释说明用途 - 实现测试清理相关的上下文管理功能 --- GFramework.SourceGenerators/rule/ContextAwareGenerator.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs b/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs index 00b61df..db695ca 100644 --- a/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs +++ b/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs @@ -161,6 +161,14 @@ public sealed class ContextAwareGenerator : MetadataAttributeClassGeneratorBase sb.AppendLine(" _contextProvider = provider;"); sb.AppendLine(" }"); sb.AppendLine(); + sb.AppendLine(" /// "); + sb.AppendLine(" /// 重置上下文提供者为默认值(用于测试清理)"); + sb.AppendLine(" /// "); + sb.AppendLine(" public static void ResetContextProvider()"); + sb.AppendLine(" {"); + sb.AppendLine(" _contextProvider = null;"); + sb.AppendLine(" }"); + sb.AppendLine(); }