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 Handle( - object request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface INotificationHandlerBase - { - global::System.Threading.Tasks.ValueTask Handle( - object notification, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface IStreamMessageHandlerBase - { - global::System.Collections.Generic.IAsyncEnumerable Handle( - object request, - global::System.Threading.CancellationToken cancellationToken - ); - } - - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface IRequestHandlerBase : IMessageHandlerBase - { - global::System.Threading.Tasks.ValueTask Handle( - global::Mediator.IRequest request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class RequestHandlerWrapper : IRequestHandlerBase - where TRequest : global::Mediator.IRequest - { - private global::Mediator.MessageHandlerDelegate _rootHandler = null!; - - public RequestHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - var concreteHandler = sp.GetRequiredService>(); - var pipelineBehaviours = sp.GetServices>(); - var handler = (global::Mediator.MessageHandlerDelegate)concreteHandler.Handle; - - global::Mediator.IPipelineBehavior[] pipelineBehavioursArray; - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is global::Mediator.IPipelineBehavior[] - ); - pipelineBehavioursArray = global::System.Runtime.CompilerServices.Unsafe.As[]>( - pipelineBehaviours - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is not global::Mediator.IPipelineBehavior[] - ); - pipelineBehavioursArray = pipelineBehaviours.ToArray(); - } - - for (int i = pipelineBehavioursArray.Length - 1; i >= 0; i--) - { - var pipeline = pipelineBehavioursArray[i]; - var handlerCopy = handler; - var pipelineCopy = pipeline; - handler = (TRequest message, System.Threading.CancellationToken cancellationToken) => pipelineCopy.Handle(message, handlerCopy, cancellationToken); - } - - _rootHandler = handler; - return this; - } - - public global::System.Threading.Tasks.ValueTask Handle( - TRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handler = _rootHandler; - return handler(request, cancellationToken); - } - - public global::System.Threading.Tasks.ValueTask Handle( - global::Mediator.IRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TRequest)request, cancellationToken); - } - - public async global::System.Threading.Tasks.ValueTask Handle( - object request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return await Handle((TRequest)request, cancellationToken); - } - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface IStreamRequestHandlerBase : IStreamMessageHandlerBase - { - global::System.Collections.Generic.IAsyncEnumerable Handle( - global::Mediator.IStreamRequest request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class StreamRequestHandlerWrapper : IStreamRequestHandlerBase - where TRequest : global::Mediator.IStreamRequest - { - private global::Mediator.StreamHandlerDelegate _rootHandler = null!; - - public StreamRequestHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - var concreteHandler = sp.GetRequiredService>(); - var pipelineBehaviours = sp.GetServices>(); - var handler = (global::Mediator.StreamHandlerDelegate)concreteHandler.Handle; - - global::Mediator.IStreamPipelineBehavior[] pipelineBehavioursArray; - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is global::Mediator.IStreamPipelineBehavior[] - ); - pipelineBehavioursArray = global::System.Runtime.CompilerServices.Unsafe.As[]>( - pipelineBehaviours - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is not global::Mediator.IStreamPipelineBehavior[] - ); - pipelineBehavioursArray = pipelineBehaviours.ToArray(); - } - - for (int i = pipelineBehavioursArray.Length - 1; i >= 0; i--) - { - var pipeline = pipelineBehavioursArray[i]; - var handlerCopy = handler; - var pipelineCopy = pipeline; - handler = (TRequest message, System.Threading.CancellationToken cancellationToken) => pipelineCopy.Handle(message, handlerCopy, cancellationToken); - } - - _rootHandler = handler; - return this; - } - - public global::System.Collections.Generic.IAsyncEnumerable Handle( - TRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handler = _rootHandler; - return handler(request, cancellationToken); - } - - public global::System.Collections.Generic.IAsyncEnumerable Handle( - global::Mediator.IStreamRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TRequest)request, cancellationToken); - } - - public async global::System.Collections.Generic.IAsyncEnumerable Handle( - object request, - [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken - ) - { - await foreach (var el in Handle((TRequest)request, cancellationToken)) - yield return el; - } - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface ICommandHandlerBase : IMessageHandlerBase - { - global::System.Threading.Tasks.ValueTask Handle( - global::Mediator.ICommand request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class CommandHandlerWrapper : ICommandHandlerBase - where TRequest : global::Mediator.ICommand - { - private global::Mediator.MessageHandlerDelegate _rootHandler = null!; - - public CommandHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - var concreteHandler = sp.GetRequiredService>(); - var pipelineBehaviours = sp.GetServices>(); - var handler = (global::Mediator.MessageHandlerDelegate)concreteHandler.Handle; - - global::Mediator.IPipelineBehavior[] pipelineBehavioursArray; - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is global::Mediator.IPipelineBehavior[] - ); - pipelineBehavioursArray = global::System.Runtime.CompilerServices.Unsafe.As[]>( - pipelineBehaviours - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is not global::Mediator.IPipelineBehavior[] - ); - pipelineBehavioursArray = pipelineBehaviours.ToArray(); - } - - for (int i = pipelineBehavioursArray.Length - 1; i >= 0; i--) - { - var pipeline = pipelineBehavioursArray[i]; - var handlerCopy = handler; - var pipelineCopy = pipeline; - handler = (TRequest message, System.Threading.CancellationToken cancellationToken) => pipelineCopy.Handle(message, handlerCopy, cancellationToken); - } - - _rootHandler = handler; - return this; - } - - public global::System.Threading.Tasks.ValueTask Handle( - TRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handler = _rootHandler; - return handler(request, cancellationToken); - } - - public global::System.Threading.Tasks.ValueTask Handle( - global::Mediator.ICommand request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TRequest)request, cancellationToken); - } - - public async global::System.Threading.Tasks.ValueTask Handle( - object request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return await Handle((TRequest)request, cancellationToken); - } - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface IStreamCommandHandlerBase : IStreamMessageHandlerBase - { - global::System.Collections.Generic.IAsyncEnumerable Handle( - global::Mediator.IStreamCommand request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class StreamCommandHandlerWrapper : IStreamCommandHandlerBase - where TRequest : global::Mediator.IStreamCommand - { - private global::Mediator.StreamHandlerDelegate _rootHandler = null!; - - public StreamCommandHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - var concreteHandler = sp.GetRequiredService>(); - var pipelineBehaviours = sp.GetServices>(); - var handler = (global::Mediator.StreamHandlerDelegate)concreteHandler.Handle; - - global::Mediator.IStreamPipelineBehavior[] pipelineBehavioursArray; - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is global::Mediator.IStreamPipelineBehavior[] - ); - pipelineBehavioursArray = global::System.Runtime.CompilerServices.Unsafe.As[]>( - pipelineBehaviours - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is not global::Mediator.IStreamPipelineBehavior[] - ); - pipelineBehavioursArray = pipelineBehaviours.ToArray(); - } - - for (int i = pipelineBehavioursArray.Length - 1; i >= 0; i--) - { - var pipeline = pipelineBehavioursArray[i]; - var handlerCopy = handler; - var pipelineCopy = pipeline; - handler = (TRequest message, System.Threading.CancellationToken cancellationToken) => pipelineCopy.Handle(message, handlerCopy, cancellationToken); - } - - _rootHandler = handler; - return this; - } - - public global::System.Collections.Generic.IAsyncEnumerable Handle( - TRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handler = _rootHandler; - return handler(request, cancellationToken); - } - - public global::System.Collections.Generic.IAsyncEnumerable Handle( - global::Mediator.IStreamCommand request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TRequest)request, cancellationToken); - } - - public async global::System.Collections.Generic.IAsyncEnumerable Handle( - object request, - [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken - ) - { - await foreach (var el in Handle((TRequest)request, cancellationToken)) - yield return el; - } - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface IQueryHandlerBase : IMessageHandlerBase - { - global::System.Threading.Tasks.ValueTask Handle( - global::Mediator.IQuery request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class QueryHandlerWrapper : IQueryHandlerBase - where TRequest : global::Mediator.IQuery - { - private global::Mediator.MessageHandlerDelegate _rootHandler = null!; - - public QueryHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - var concreteHandler = sp.GetRequiredService>(); - var pipelineBehaviours = sp.GetServices>(); - var handler = (global::Mediator.MessageHandlerDelegate)concreteHandler.Handle; - - global::Mediator.IPipelineBehavior[] pipelineBehavioursArray; - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is global::Mediator.IPipelineBehavior[] - ); - pipelineBehavioursArray = global::System.Runtime.CompilerServices.Unsafe.As[]>( - pipelineBehaviours - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is not global::Mediator.IPipelineBehavior[] - ); - pipelineBehavioursArray = pipelineBehaviours.ToArray(); - } - - for (int i = pipelineBehavioursArray.Length - 1; i >= 0; i--) - { - var pipeline = pipelineBehavioursArray[i]; - var handlerCopy = handler; - var pipelineCopy = pipeline; - handler = (TRequest message, System.Threading.CancellationToken cancellationToken) => pipelineCopy.Handle(message, handlerCopy, cancellationToken); - } - - _rootHandler = handler; - return this; - } - - public global::System.Threading.Tasks.ValueTask Handle( - TRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handler = _rootHandler; - return handler(request, cancellationToken); - } - - public global::System.Threading.Tasks.ValueTask Handle( - global::Mediator.IQuery request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TRequest)request, cancellationToken); - } - - public async global::System.Threading.Tasks.ValueTask Handle( - object request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return await Handle((TRequest)request, cancellationToken); - } - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - internal interface IStreamQueryHandlerBase : IStreamMessageHandlerBase - { - global::System.Collections.Generic.IAsyncEnumerable Handle( - global::Mediator.IStreamQuery request, - global::System.Threading.CancellationToken cancellationToken - ); - } - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class StreamQueryHandlerWrapper : IStreamQueryHandlerBase - where TRequest : global::Mediator.IStreamQuery - { - private global::Mediator.StreamHandlerDelegate _rootHandler = null!; - - public StreamQueryHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - var concreteHandler = sp.GetRequiredService>(); - var pipelineBehaviours = sp.GetServices>(); - var handler = (global::Mediator.StreamHandlerDelegate)concreteHandler.Handle; - - global::Mediator.IStreamPipelineBehavior[] pipelineBehavioursArray; - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is global::Mediator.IStreamPipelineBehavior[] - ); - pipelineBehavioursArray = global::System.Runtime.CompilerServices.Unsafe.As[]>( - pipelineBehaviours - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - pipelineBehaviours is not global::Mediator.IStreamPipelineBehavior[] - ); - pipelineBehavioursArray = pipelineBehaviours.ToArray(); - } - - for (int i = pipelineBehavioursArray.Length - 1; i >= 0; i--) - { - var pipeline = pipelineBehavioursArray[i]; - var handlerCopy = handler; - var pipelineCopy = pipeline; - handler = (TRequest message, System.Threading.CancellationToken cancellationToken) => pipelineCopy.Handle(message, handlerCopy, cancellationToken); - } - - _rootHandler = handler; - return this; - } - - public global::System.Collections.Generic.IAsyncEnumerable Handle( - TRequest request, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handler = _rootHandler; - return handler(request, cancellationToken); - } - - public global::System.Collections.Generic.IAsyncEnumerable Handle( - global::Mediator.IStreamQuery request, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TRequest)request, cancellationToken); - } - - public async global::System.Collections.Generic.IAsyncEnumerable Handle( - object request, - [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken - ) - { - await foreach (var el in Handle((TRequest)request, cancellationToken)) - yield return el; - } - } - - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class NotificationHandlerWrapper : INotificationHandlerBase - where TNotification : global::Mediator.INotification - { - private global::Mediator.ForeachAwaitPublisher _publisher = null!; - private global::Mediator.INotificationHandler[] _handlers = null!; - - public NotificationHandlerWrapper Init( - global::Mediator.Internals.ContainerMetadata containerMetadata, - global::System.IServiceProvider sp - ) - { - _publisher = containerMetadata.NotificationPublisher; - var handlers = sp.GetServices>(); - if (containerMetadata.ServicesUnderlyingTypeIsArray) - { - global::System.Diagnostics.Debug.Assert( - handlers is global::Mediator.INotificationHandler[], - $"Unexpected type: {handlers.GetType()}" - ); - _handlers = global::System.Runtime.CompilerServices.Unsafe.As[]>( - handlers - ); - } - else - { - global::System.Diagnostics.Debug.Assert( - handlers is not global::Mediator.INotificationHandler[], - $"Unexpected type: {handlers.GetType()}" - ); - _handlers = handlers.ToArray(); - } - return this; - } - - public global::System.Threading.Tasks.ValueTask Handle( - TNotification notification, - global::System.Threading.CancellationToken cancellationToken - ) - { - var handlers = _handlers; - if (handlers.Length == 0) - { - return default; - } - return _publisher.Publish( - new global::Mediator.NotificationHandlers(handlers, isArray: true), - notification, - cancellationToken - ); - } - - public global::System.Threading.Tasks.ValueTask Handle( - object notification, - global::System.Threading.CancellationToken cancellationToken - ) - { - return Handle((TNotification)notification, cancellationToken); - } - } - - internal interface IContainerProbe { } - internal sealed class ContainerProbe0 : IContainerProbe { } - internal sealed class ContainerProbe1 : IContainerProbe { } - - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - internal sealed class ContainerMetadata - { - public readonly bool ServicesUnderlyingTypeIsArray; - - public readonly global::System.Collections.Frozen.FrozenDictionary RequestHandlerWrappers; - public readonly global::System.Collections.Frozen.FrozenDictionary CommandHandlerWrappers; - public readonly global::System.Collections.Frozen.FrozenDictionary QueryHandlerWrappers; - - public readonly global::System.Collections.Frozen.FrozenDictionary StreamRequestHandlerWrappers; - public readonly global::System.Collections.Frozen.FrozenDictionary StreamCommandHandlerWrappers; - public readonly global::System.Collections.Frozen.FrozenDictionary StreamQueryHandlerWrappers; - - public readonly global::System.Collections.Frozen.FrozenDictionary NotificationHandlerWrappers; - - public readonly global::Mediator.ForeachAwaitPublisher NotificationPublisher; - - public ContainerMetadata(global::System.IServiceProvider sp) - { - ServicesUnderlyingTypeIsArray = sp.GetServices() is global::Mediator.Internals.IContainerProbe[]; - - NotificationPublisher = sp.GetRequiredService(); - - var requestHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - var commandHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - var queryHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - RequestHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(requestHandlerTypes); - CommandHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(commandHandlerTypes); - QueryHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(queryHandlerTypes); - - var streamRequestHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - var streamCommandHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - var streamQueryHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - StreamRequestHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(streamRequestHandlerTypes); - StreamCommandHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(streamCommandHandlerTypes); - StreamQueryHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(streamQueryHandlerTypes); - - var notificationHandlerTypes = new global::System.Collections.Generic.Dictionary(0); - NotificationHandlerWrappers = global::System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary(notificationHandlerTypes); - } - } -} - -namespace Mediator -{ - /// - /// Generated code for Mediator implementation. - /// This type is also registered as a DI service. - /// Can be used directly for high performance scenarios. - /// - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.Diagnostics.DebuggerStepThroughAttribute] - public sealed partial class Mediator : global::Mediator.IMediator, global::Mediator.ISender, global::Mediator.IPublisher - { - internal readonly global::System.IServiceProvider Services; - private FastLazyValue _containerMetadata; - private global::Mediator.ForeachAwaitPublisher? _notificationPublisher; - internal global::Mediator.ForeachAwaitPublisher NotificationPublisher - { - [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - get - { - if (_notificationPublisher == null) - _notificationPublisher = _containerMetadata.Value.NotificationPublisher; - return _notificationPublisher!; - } - } - private bool? _servicesUnderlyingTypeIsArray; - internal bool ServicesUnderlyingTypeIsArray - { - [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - get - { - if (_servicesUnderlyingTypeIsArray == null) - _servicesUnderlyingTypeIsArray = _containerMetadata.Value.ServicesUnderlyingTypeIsArray; - return _servicesUnderlyingTypeIsArray!.Value; - } - } - - /// - /// The lifetime of Mediator-related service registrations in DI container. - /// - public const global::Microsoft.Extensions.DependencyInjection.ServiceLifetime ServiceLifetime = global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton; - - /// - /// The name of the notification publisher service that was configured. - /// - public const string NotificationPublisherName = "ForeachAwaitPublisher"; - - /// - /// The total number of Mediator messages that were discovered. - /// - public const int TotalMessages = 0; - - /// - /// Constructor for DI, should not be used by consumer. - /// - public Mediator(global::System.IServiceProvider sp) - { - Services = sp; - _containerMetadata = new FastLazyValue( - self => self.Services.GetRequiredService(), - this - ); - } - - private struct FastLazyValue - { - private const long UNINIT = 0; - private const long INITING = 1; - private const long INITD = 2; - - private global::System.Func _generator; - private long _state; - private T _value; - private TArg _arg; - - public T Value - { - [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - get - { - if (_state != INITD) - return ValueSlow; - - return _value; - } - } - - private T ValueSlow - { - [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] - get - { - var prevState = global::System.Threading.Interlocked.CompareExchange(ref _state, INITING, UNINIT); - switch (prevState) - { - case INITD: - // Someone has already completed init - return _value; - case INITING: - // Wait for someone else to complete - var spinWait = default(global::System.Threading.SpinWait); - while (global::System.Threading.Interlocked.Read(ref _state) < INITD) - spinWait.SpinOnce(); - return _value; - case UNINIT: - _value = _generator(_arg); - global::System.Threading.Interlocked.Exchange(ref _state, INITD); - return _value; - } - - return _value; - } - } - - public FastLazyValue(global::System.Func generator, TArg arg) - { - _generator = generator; - _state = UNINIT; - _value = default!; - _arg = arg; - } - } - - - - /// - /// Send request. - /// Throws if message is null. - /// Throws if request does not implement . - /// Throws if no handler is registered. - /// - /// Incoming request - /// Cancellation token - /// Awaitable task - public global::System.Threading.Tasks.ValueTask Send( - global::Mediator.IRequest request, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidRequest(request, nameof(request)); - return default; - } - - private async global::System.Threading.Tasks.ValueTask SendAsync( - global::Mediator.IRequest request, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidRequest(request, nameof(request)); - return default!; - } - - /// - /// Create stream for request. - /// Throws if message is null. - /// Throws if request does not implement . - /// Throws if no handler is registered. - /// - /// Incoming message - /// Cancellation token - /// Async enumerable - public global::System.Collections.Generic.IAsyncEnumerable CreateStream( - global::Mediator.IStreamRequest request, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidStreamRequest(request, nameof(request)); - return default!; - } - - /// - /// Send command. - /// Throws if message is null. - /// Throws if command does not implement . - /// Throws if no handler is registered. - /// - /// Incoming command - /// Cancellation token - /// Awaitable task - public global::System.Threading.Tasks.ValueTask Send( - global::Mediator.ICommand command, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidCommand(command, nameof(command)); - return default; - } - - private async global::System.Threading.Tasks.ValueTask SendAsync( - global::Mediator.ICommand command, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidCommand(command, nameof(command)); - return default!; - } - - /// - /// Create stream for command. - /// Throws if message is null. - /// Throws if command does not implement . - /// Throws if no handler is registered. - /// - /// Incoming message - /// Cancellation token - /// Async enumerable - public global::System.Collections.Generic.IAsyncEnumerable CreateStream( - global::Mediator.IStreamCommand command, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidStreamCommand(command, nameof(command)); - return default!; - } - - /// - /// Send query. - /// Throws if message is null. - /// Throws if query does not implement . - /// Throws if no handler is registered. - /// - /// Incoming query - /// Cancellation token - /// Awaitable task - public global::System.Threading.Tasks.ValueTask Send( - global::Mediator.IQuery query, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidQuery(query, nameof(query)); - return default; - } - - private async global::System.Threading.Tasks.ValueTask SendAsync( - global::Mediator.IQuery query, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidQuery(query, nameof(query)); - return default!; - } - - /// - /// Create stream for query. - /// Throws if message is null. - /// Throws if query does not implement . - /// Throws if no handler is registered. - /// - /// Incoming message - /// Cancellation token - /// Async enumerable - public global::System.Collections.Generic.IAsyncEnumerable CreateStream( - global::Mediator.IStreamQuery query, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidStreamQuery(query, nameof(query)); - return default!; - } - - /// - /// Send message. - /// Throws if message is null. - /// Throws if message does not implement . - /// Throws if no handler is registered. - /// - /// Incoming message - /// Cancellation token - /// Awaitable task - public global::System.Threading.Tasks.ValueTask Send( - object message, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidMessage(message, nameof(message)); - return default; - } - - /// - /// Create stream. - /// Throws if message is null. - /// Throws if message does not implement . - /// Throws if no handler is registered. - /// - /// Incoming message - /// Cancellation token - /// Async enumerable - public global::System.Collections.Generic.IAsyncEnumerable CreateStream( - object message, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidStreamMessage(message, nameof(message)); - return default!; - } - - /// - /// Publish notification. - /// Throws if message is null. - /// Throws if notification does not implement . - /// Throws if handlers throw exception(s). - /// Drops messages - /// - /// Incoming notification - /// Cancellation token - /// Awaitable task - public global::System.Threading.Tasks.ValueTask Publish( - object notification, - global::System.Threading.CancellationToken cancellationToken = default - ) - { - ThrowInvalidNotification(notification, nameof(notification)); - return default; - } - - /// - /// Publish notification. - /// Throws if message is null. - /// Throws if notification does not implement . - /// Throws if handlers throw exception(s). - /// - /// Incoming notification - /// Cancellation token - /// Awaitable task - public global::System.Threading.Tasks.ValueTask Publish( - TNotification notification, - global::System.Threading.CancellationToken cancellationToken = default - ) - where TNotification : global::Mediator.INotification - { - ThrowInvalidNotification(notification, nameof(notification)); - return default; - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowMissingHandler(object msg) => - throw new global::Mediator.MissingMessageHandlerException(msg); - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidMessage(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IMessage)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidRequest(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IBaseRequest)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidCommand(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IBaseCommand)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidQuery(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IBaseQuery)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidStreamMessage(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IStreamMessage)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidStreamRequest(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IBaseStreamRequest)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidStreamCommand(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IBaseStreamCommand)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidStreamQuery(T? msg, string? paramName = null) - { - if (msg == null) - ThrowArgumentNull(paramName); - else if (!(msg is global::Mediator.IBaseStreamQuery)) - ThrowInvalidMessage(msg); - else - ThrowMissingHandler(msg); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowArgumentNull(string? paramName) => - throw new global::System.ArgumentNullException(paramName); - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowInvalidMessage(T msg) => - throw new global::Mediator.InvalidMessageException(msg); - - private static void ThrowIfNull(T? argument, string paramName) - { - if (argument == null) - ThrowArgumentNull(paramName); - } - - private static void ThrowInvalidNotification(T? argument, string paramName) - { - if (argument == null) - ThrowArgumentNull(paramName); - else if (!(argument is global::Mediator.INotification)) - ThrowInvalidMessage(argument); - } - -#if NETSTANDARD2_1_OR_GREATER - [global::System.Diagnostics.CodeAnalysis.DoesNotReturn] -#endif - private static void ThrowAggregateException(global::System.Collections.Generic.List exceptions) => - throw new global::System.AggregateException(exceptions); - - private static void MaybeThrowAggregateException(global::System.Collections.Generic.List? exceptions) - { - if (exceptions != null) - { - ThrowAggregateException(exceptions); - } - } - } -} diff --git a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptions.g.cs b/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptions.g.cs deleted file mode 100644 index 309c180..0000000 --- a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Generated by the Mediator source generator. -// - -namespace Mediator -{ - /// - /// Provide options for the Mediator source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - public sealed class MediatorOptions - { - /// - /// The namespace in which the Mediator implementation is generated. - /// By default, the namespace is "Mediator". - /// - public string Namespace { get; set; } = "Mediator"; - - /// - /// Wether or not generated types should be internal (they are public by default). - /// - public bool GenerateTypesAsInternal { get; set; } = false; - - /// - /// The type to use when publishing notifications. - /// By default, the type is . - /// - public global::System.Type NotificationPublisherType { get; set; } = typeof(global::Mediator.ForeachAwaitPublisher); - - /// - /// The default lifetime of the services registered in the DI container by the Mediator source generator. - /// By default, the lifetime is . - /// - public global::Microsoft.Extensions.DependencyInjection.ServiceLifetime ServiceLifetime { get; set; } = - global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton; - - /// - /// The collection of assemblies to scan for Mediator handlers. - /// By default, the collection is empty, in which case the source generator will scan all assemblies through references from the source generated project. - /// - public global::System.Collections.Generic.IReadOnlyList Assemblies { get; set; } = new global::Mediator.AssemblyReference[0]; - - /// - /// The collection of types of pipeline behaviors to register in DI. - /// When the type is an unconstructed generic type, the source generator will register all the constructed types of the generic type (open generics that is supported during AoT). - /// - public global::System.Collections.Generic.IReadOnlyList PipelineBehaviors { get; set; } = new global::System.Type[0]; - - /// - /// The collection of types of streaming pipeline behaviors to register in DI. - /// When the type is an unconstructed generic type, the source generator will register all the constructed types of the generic type (open generics that is supported during AoT). - /// - public global::System.Collections.Generic.IReadOnlyList StreamPipelineBehaviors { get; set; } = new global::System.Type[0]; - } -} diff --git a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptionsAttribute.g.cs b/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptionsAttribute.g.cs deleted file mode 100644 index 8ecee2a..0000000 --- a/GFramework.SourceGenerators/Generated/Mediator.SourceGenerator/Mediator.SourceGenerator.IncrementalMediatorGenerator/MediatorOptionsAttribute.g.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Generated by the Mediator source generator. -// - -namespace Mediator -{ - /// - /// Provide options for the Mediator source generator. - /// - [global::System.AttributeUsage(global::System.AttributeTargets.Assembly, AllowMultiple = false)] - [global::System.CodeDom.Compiler.GeneratedCode("Mediator.SourceGenerator", "3.0.0.0")] - public sealed class MediatorOptionsAttribute : global::System.Attribute - { - /// - /// The namespace in which the Mediator implementation is generated. - /// By default, the namespace is "Mediator". - /// - public string Namespace { get; set; } = "Mediator"; - - /// - /// The type to use when publishing notifications. - /// By default, the type is . - /// - public global::System.Type NotificationPublisherType { get; set; } = typeof(global::Mediator.ForeachAwaitPublisher); - - /// - /// The default lifetime of the services registered in the DI container by the Mediator source generator. - /// By default, the lifetime is . - /// - public global::Microsoft.Extensions.DependencyInjection.ServiceLifetime ServiceLifetime { get; set; } = - global::Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton; - } -}