From 8db379c53f9462e2061e61536e4e6cb60f68c5b0 Mon Sep 17 00:00:00 2001
From: GeWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Thu, 5 Mar 2026 08:45:12 +0800
Subject: [PATCH] =?UTF-8?q?refactor(mediator):=20=E7=A7=BB=E9=99=A4?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E7=9A=84=E7=A8=8B=E5=BA=8F?=
=?UTF-8?q?=E9=9B=86=E5=BC=95=E7=94=A8=E5=92=8C=E4=B8=AD=E4=BB=8B=E8=80=85?=
=?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 删除了 AssemblyReference.g.cs 中的程序集引用生成代码
- 移除了 Mediator.g.cs 中的中介者依赖注入扩展实现
- 清理了内部消息处理器基类和包装器的自动生成代码
- 移除了容器探测器和元数据相关的生成代码
- 删除了中介者主类的自动生成实现
---
.../AssemblyReference.g.cs | 38 -
.../Mediator.g.cs | 1179 -----------------
.../MediatorOptions.g.cs | 55 -
.../MediatorOptionsAttribute.g.cs | 33 -
4 files changed, 1305 deletions(-)
delete mode 100644 GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/AssemblyReference.g.cs
delete mode 100644 GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/Mediator.g.cs
delete mode 100644 GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptions.g.cs
delete mode 100644 GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptionsAttribute.g.cs
diff --git a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/AssemblyReference.g.cs b/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/AssemblyReference.g.cs
deleted file mode 100644
index ab2d7cd..0000000
--- a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/AssemblyReference.g.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Generated by the Mediator source generator.
-//
-
-namespace Mediator
-{
- ///
- /// Represents an assembly reference.
- /// This is used to specify the types or assemblies to scan for Mediator handlers.
- ///
- [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")]
- public sealed class AssemblyReference
- {
- ///
- /// The assembly reference.
- ///
- public global::System.Reflection.Assembly Assembly { get; }
-
- private AssemblyReference(global::System.Reflection.Assembly assembly)
- {
- Assembly = assembly;
- }
-
- ///
- /// Creates a new instance of from the specified type.
- ///
- /// The type
- /// A new instance of
- public static implicit operator AssemblyReference(global::System.Type type) => new AssemblyReference(type.Assembly);
-
- ///
- /// Creates a new instance of from the specified assembly.
- ///
- /// The assembly
- /// A new instance of
- public static implicit operator AssemblyReference(global::System.Reflection.Assembly assembly) => new AssemblyReference(assembly);
- }
-}
diff --git a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/Mediator.g.cs b/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/Mediator.g.cs
deleted file mode 100644
index 13eafaa..0000000
--- a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/Mediator.g.cs
+++ /dev/null
@@ -1,1179 +0,0 @@
-//
-// Generated by the Mediator source generator.
-//
-
-#pragma warning disable CS8019 // Unused usings
-#pragma warning disable CS8321 // Unused local function
-#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
-
-#nullable enable
-
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using System.Linq;
-
-namespace Microsoft.Extensions.DependencyInjection
-{
- ///
- /// DI extensions for Mediator.
- ///
- [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.Diagnostics.DebuggerStepThroughAttribute]
- public static class MediatorDependencyInjectionExtensions
- {
- ///
- /// Adds the Mediator implementation and handlers of your application.
- ///
- public static IServiceCollection AddMediator(this IServiceCollection services)
- {
- return AddMediator(services, null);
- }
-
- ///
- /// Adds the Mediator implementation and handlers of your application, with specified options.
- ///
- public static IServiceCollection AddMediator(this IServiceCollection services, global::System.Action? options)
- {
- var opts = new global::Mediator.MediatorOptions();
- if (options != null)
- options(opts);
-
- var configuredViaAttribute = false;
- if (opts.ServiceLifetime != global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton && !configuredViaAttribute)
- {
- var errMsg = "Invalid configuration detected for Mediator. ";
- errMsg += "Generated code for 'Singleton' lifetime, but got '" + opts.ServiceLifetime + "' lifetime from options. ";
- errMsg += "This means that the source generator hasn't seen the 'AddMediator' method call during compilation. ";
- errMsg += "Make sure that the 'AddMediator' method is called from the project that references the Mediator.SourceGenerator package.";
- throw new global::System.Exception(errMsg);
- }
-
- services.Add(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.Mediator), typeof(global::Mediator.Mediator), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
- services.TryAdd(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.IMediator), sp => sp.GetRequiredService(), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
- services.TryAdd(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.ISender), sp => sp.GetRequiredService(), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
- services.TryAdd(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.IPublisher), sp => sp.GetRequiredService(), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
-
- // Register the notification publisher that was configured
- services.Add(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.ForeachAwaitPublisher), typeof(global::Mediator.ForeachAwaitPublisher), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
- services.TryAdd(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.INotificationPublisher), sp => sp.GetRequiredService(), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
-
- // Register internal components
- services.Add(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.Internals.IContainerProbe), typeof(global::Mediator.Internals.ContainerProbe0), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
- services.Add(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.Internals.IContainerProbe), typeof(global::Mediator.Internals.ContainerProbe1), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
- services.Add(new global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(global::Mediator.Internals.ContainerMetadata), typeof(global::Mediator.Internals.ContainerMetadata), global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton));
-
- return services;
-
- }
- }
-}
-
-namespace Mediator.Internals
-{
- [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")]
- internal interface IMessageHandlerBase
- {
- global::System.Threading.Tasks.ValueTask