From be2ee5627097ad3b2abf1b5d39cd3f424ed53818 Mon Sep 17 00:00:00 2001 From: Head0nF1re <77078775+Head0nF1re@users.noreply.github.com> Date: Mon, 15 Jan 2024 03:50:49 +0000 Subject: [PATCH] Improve Handler behavior names (#18) --- .../ImmediateHandlersGenerator_Entrypoint.cs | 28 +++++++++- ...ateHandlersGenerator_TransformBehaviors.cs | 1 + .../ImmediateHandlersGenerator_Types.cs | 2 + .../Templates/Handler.sbntxt | 41 ++++++++------ ...ies=Msdi#Dummy.GetUsersQuery.g.verified.cs | 46 ++++++++++------ ...#ServiceCollectionExtensions.g.verified.cs | 3 ++ ...s=Normal#Dummy.GetUsersQuery.g.verified.cs | 46 ++++++++++------ .../Behaviors/MultipleBehaviorTest.cs | 54 ++++++++++++++++++- ...ies=Msdi#Dummy.GetUsersQuery.g.verified.cs | 26 ++++----- ...s=Normal#Dummy.GetUsersQuery.g.verified.cs | 26 ++++----- 10 files changed, 194 insertions(+), 79 deletions(-) diff --git a/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Entrypoint.cs b/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Entrypoint.cs index b62d6cfe..1846bf1e 100644 --- a/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Entrypoint.cs +++ b/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Entrypoint.cs @@ -146,6 +146,32 @@ Template template if (pipelineBehaviors.Any(b => b is null)) return; + var typesCount = new Dictionary() + { + ["HandleBehavior"] = 1, + }; + + string GetVariableNameSuffix(string typeName) + { + if (!typesCount.TryGetValue(typeName, out var count)) + count = 0; + + typesCount[typeName] = count + 1; + return count == 0 ? string.Empty : $"{count}"; + } + +#pragma warning disable CA1308 // Normalize strings to uppercase + var renderBehaviors = pipelineBehaviors + .Select(b => new + { + b!.NonGenericTypeName, + VariableName = b.Name[0..1].ToLowerInvariant() + + b.Name[1..] + + GetVariableNameSuffix(b.Name) + }) + .ToList(); +#pragma warning restore CA1308 // Normalize strings to uppercase + var handlerSource = template.Render(new { ClassFullyQualifiedName = handler.DisplayName, @@ -158,7 +184,7 @@ Template template RequestType = handler.RequestType.Name, ResponseType = handler.ResponseType.Name, - Behaviors = pipelineBehaviors, + Behaviors = renderBehaviors, HasMsDi = hasMsDi, }); diff --git a/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_TransformBehaviors.cs b/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_TransformBehaviors.cs index 2beaeb3f..687c01e2 100644 --- a/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_TransformBehaviors.cs +++ b/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_TransformBehaviors.cs @@ -87,6 +87,7 @@ CancellationToken cancellationToken NonGenericTypeName = constructorType, RequestType = constraint.RequestType, ResponseType = constraint.ResponseType, + Name = originalDefinition.Name, }; }) .ToEquatableReadOnlyList(); diff --git a/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Types.cs b/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Types.cs index f94f3bd2..d2b6e694 100644 --- a/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Types.cs +++ b/src/Immediate.Handlers.Generators/ImmediateHandlers/ImmediateHandlersGenerator_Types.cs @@ -14,6 +14,8 @@ private sealed record Behavior public required string NonGenericTypeName { get; init; } public required string? RequestType { get; init; } public required string? ResponseType { get; init; } + + public required string Name { get; init; } } [ExcludeFromCodeCoverage] diff --git a/src/Immediate.Handlers.Generators/Templates/Handler.sbntxt b/src/Immediate.Handlers.Generators/Templates/Handler.sbntxt index a58c6f06..86192858 100644 --- a/src/Immediate.Handlers.Generators/Templates/Handler.sbntxt +++ b/src/Immediate.Handlers.Generators/Templates/Handler.sbntxt @@ -12,39 +12,46 @@ partial class {{ class_name }} { public sealed class Handler : global::Immediate.Handlers.Shared.IHandler<{{ request_type }}, {{ response_type }}> { - private readonly {{ class_fully_qualified_name }}.HandleBehavior _behavior_0; + private readonly {{ class_fully_qualified_name }}.HandleBehavior _HandleBehavior; {{~ for behavior in (behaviors | array.reverse) ~}} - private readonly {{ behavior.non_generic_type_name }}<{{ request_type }}, {{ response_type }}> _behavior_{{for.index + 1}}; - {{~ end ~}} - + private readonly {{ behavior.non_generic_type_name }}<{{ request_type }}, {{ response_type }}> _{{ behavior.variable_name }}; + {{~ end ~}} + public Handler( - {{ class_fully_qualified_name }}.HandleBehavior behavior_0{{ if behaviors.size > 0 }},{{ end }} + {{ class_fully_qualified_name }}.HandleBehavior HandleBehavior{{ if behaviors.size > 0 }},{{ end }} {{~ for behavior in (behaviors | array.reverse) ~}} - {{ behavior.non_generic_type_name }}<{{ request_type }}, {{ response_type }}> behavior_{{for.index + 1}}{{ if !for.last }},{{end }} + {{ behavior.non_generic_type_name }}<{{ request_type }}, {{ response_type }}> {{ behavior.variable_name }}{{ if !for.last }},{{end }} {{~ end ~}} ) { - _behavior_0 = behavior_0; + _HandleBehavior = HandleBehavior; {{~ for behavior in behaviors ~}} - _behavior_{{for.index + 1}} = behavior_{{for.index + 1}}; + _{{ behavior.variable_name }} = {{ behavior.variable_name }}; {{~ end ~}} - {{~ $length = behaviors.size ~}} - {{~ if $length > 0 ~}} - {{~ for i in 1..$length ~}} - _behavior_{{ i }}.SetInnerHandler(_behavior_{{ i - 1 }}); + {{~ for behavior in (behaviors | array.reverse) ~}} + {{~ if for.first ~}} + _{{ behavior.variable_name }}.SetInnerHandler(_HandleBehavior); + {{~ else ~}} + _{{ behavior.variable_name }}.SetInnerHandler(_{{ behaviors[behaviors.size - for.index].variable_name }}); {{~ end ~}} {{~ end ~}} } - + public async global::System.Threading.Tasks.ValueTask<{{ response_type }}> HandleAsync( {{ request_type }} request, global::System.Threading.CancellationToken cancellationToken = default ) { - return await _behavior_{{ $length }} + {{~ if behaviors.size > 0 ~}} + return await _{{ behaviors[0].variable_name }} .HandleAsync(request, cancellationToken) .ConfigureAwait(false); + {{~ else ~}} + return await _HandleBehavior + .HandleAsync(request, cancellationToken) + .ConfigureAwait(false); + {{~ end ~}} } } @@ -54,7 +61,7 @@ partial class {{ class_name }} {{~ for parameter in handler_parameters ~}} private readonly {{ parameter.type }} _{{ parameter.name }}; {{~ end ~}} - + public HandleBehavior( {{~ for parameter in handler_parameters ~}} {{ parameter.type }} {{ parameter.name }}{{ if !for.last }},{{ end }} @@ -65,7 +72,7 @@ partial class {{ class_name }} _{{ parameter.name }} = {{ parameter.name }}; {{~ end ~}} } - + public override async global::System.Threading.Tasks.ValueTask<{{ response_type }}> HandleAsync( {{ request_type }} request, global::System.Threading.CancellationToken cancellationToken @@ -73,7 +80,7 @@ partial class {{ class_name }} { return await {{ class_fully_qualified_name }} .{{ method_name }}( - request, + request, {{~ for parameter in handler_parameters ~}} _{{ parameter.name }}, {{~ end ~}} diff --git a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs index d739b1dc..a59b479b 100644 --- a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs +++ b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs @@ -9,30 +9,42 @@ partial class GetUsersQuery { public sealed class Handler : global::Immediate.Handlers.Shared.IHandler> { - private readonly global::Dummy.GetUsersQuery.HandleBehavior _behavior_0; - private readonly global::Dummy.SecondLoggingBehavior> _behavior_1; - private readonly global::Dummy.LoggingBehavior> _behavior_2; - + private readonly global::Dummy.GetUsersQuery.HandleBehavior _HandleBehavior; + private readonly global::YetAnotherDummy.SecondLoggingBehavior> _secondLoggingBehavior1; + private readonly global::YetAnotherDummy.LoggingBehavior> _loggingBehavior1; + private readonly global::Dummy.SecondLoggingBehavior> _secondLoggingBehavior; + private readonly global::YetAnotherDummy.OtherBehavior> _otherBehavior; + private readonly global::Dummy.LoggingBehavior> _loggingBehavior; + public Handler( - global::Dummy.GetUsersQuery.HandleBehavior behavior_0, - global::Dummy.SecondLoggingBehavior> behavior_1, - global::Dummy.LoggingBehavior> behavior_2 + global::Dummy.GetUsersQuery.HandleBehavior HandleBehavior, + global::YetAnotherDummy.SecondLoggingBehavior> secondLoggingBehavior1, + global::YetAnotherDummy.LoggingBehavior> loggingBehavior1, + global::Dummy.SecondLoggingBehavior> secondLoggingBehavior, + global::YetAnotherDummy.OtherBehavior> otherBehavior, + global::Dummy.LoggingBehavior> loggingBehavior ) { - _behavior_0 = behavior_0; - _behavior_1 = behavior_1; - _behavior_2 = behavior_2; + _HandleBehavior = HandleBehavior; + _loggingBehavior = loggingBehavior; + _otherBehavior = otherBehavior; + _secondLoggingBehavior = secondLoggingBehavior; + _loggingBehavior1 = loggingBehavior1; + _secondLoggingBehavior1 = secondLoggingBehavior1; - _behavior_1.SetInnerHandler(_behavior_0); - _behavior_2.SetInnerHandler(_behavior_1); + _secondLoggingBehavior1.SetInnerHandler(_HandleBehavior); + _loggingBehavior1.SetInnerHandler(_secondLoggingBehavior1); + _secondLoggingBehavior.SetInnerHandler(_loggingBehavior1); + _otherBehavior.SetInnerHandler(_secondLoggingBehavior); + _loggingBehavior.SetInnerHandler(_otherBehavior); } - + public async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken = default ) { - return await _behavior_2 + return await _loggingBehavior .HandleAsync(request, cancellationToken) .ConfigureAwait(false); } @@ -42,14 +54,14 @@ public Handler( public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior> { private readonly global::Dummy.UsersService _usersService; - + public HandleBehavior( global::Dummy.UsersService usersService ) { _usersService = usersService; } - + public override async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken @@ -57,7 +69,7 @@ public HandleBehavior( { return await global::Dummy.GetUsersQuery .HandleAsync( - request, + request, _usersService, cancellationToken ) diff --git a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#ServiceCollectionExtensions.g.verified.cs b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#ServiceCollectionExtensions.g.verified.cs index b055bb9b..75b81b51 100644 --- a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#ServiceCollectionExtensions.g.verified.cs +++ b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Msdi#ServiceCollectionExtensions.g.verified.cs @@ -9,7 +9,10 @@ public static class HandlerServiceCollectionExtensions this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services) { services.AddScoped(typeof(global::Dummy.LoggingBehavior<,>)); + services.AddScoped(typeof(global::YetAnotherDummy.OtherBehavior<,>)); services.AddScoped(typeof(global::Dummy.SecondLoggingBehavior<,>)); + services.AddScoped(typeof(global::YetAnotherDummy.LoggingBehavior<,>)); + services.AddScoped(typeof(global::YetAnotherDummy.SecondLoggingBehavior<,>)); return services; } diff --git a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs index 75360d3e..432fa7bf 100644 --- a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs +++ b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.MultipleBehaviors_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs @@ -7,30 +7,42 @@ partial class GetUsersQuery { public sealed class Handler : global::Immediate.Handlers.Shared.IHandler> { - private readonly global::Dummy.GetUsersQuery.HandleBehavior _behavior_0; - private readonly global::Dummy.SecondLoggingBehavior> _behavior_1; - private readonly global::Dummy.LoggingBehavior> _behavior_2; - + private readonly global::Dummy.GetUsersQuery.HandleBehavior _HandleBehavior; + private readonly global::YetAnotherDummy.SecondLoggingBehavior> _secondLoggingBehavior1; + private readonly global::YetAnotherDummy.LoggingBehavior> _loggingBehavior1; + private readonly global::Dummy.SecondLoggingBehavior> _secondLoggingBehavior; + private readonly global::YetAnotherDummy.OtherBehavior> _otherBehavior; + private readonly global::Dummy.LoggingBehavior> _loggingBehavior; + public Handler( - global::Dummy.GetUsersQuery.HandleBehavior behavior_0, - global::Dummy.SecondLoggingBehavior> behavior_1, - global::Dummy.LoggingBehavior> behavior_2 + global::Dummy.GetUsersQuery.HandleBehavior HandleBehavior, + global::YetAnotherDummy.SecondLoggingBehavior> secondLoggingBehavior1, + global::YetAnotherDummy.LoggingBehavior> loggingBehavior1, + global::Dummy.SecondLoggingBehavior> secondLoggingBehavior, + global::YetAnotherDummy.OtherBehavior> otherBehavior, + global::Dummy.LoggingBehavior> loggingBehavior ) { - _behavior_0 = behavior_0; - _behavior_1 = behavior_1; - _behavior_2 = behavior_2; + _HandleBehavior = HandleBehavior; + _loggingBehavior = loggingBehavior; + _otherBehavior = otherBehavior; + _secondLoggingBehavior = secondLoggingBehavior; + _loggingBehavior1 = loggingBehavior1; + _secondLoggingBehavior1 = secondLoggingBehavior1; - _behavior_1.SetInnerHandler(_behavior_0); - _behavior_2.SetInnerHandler(_behavior_1); + _secondLoggingBehavior1.SetInnerHandler(_HandleBehavior); + _loggingBehavior1.SetInnerHandler(_secondLoggingBehavior1); + _secondLoggingBehavior.SetInnerHandler(_loggingBehavior1); + _otherBehavior.SetInnerHandler(_secondLoggingBehavior); + _loggingBehavior.SetInnerHandler(_otherBehavior); } - + public async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken = default ) { - return await _behavior_2 + return await _loggingBehavior .HandleAsync(request, cancellationToken) .ConfigureAwait(false); } @@ -40,14 +52,14 @@ public Handler( public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior> { private readonly global::Dummy.UsersService _usersService; - + public HandleBehavior( global::Dummy.UsersService usersService ) { _usersService = usersService; } - + public override async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken @@ -55,7 +67,7 @@ public HandleBehavior( { return await global::Dummy.GetUsersQuery .HandleAsync( - request, + request, _usersService, cancellationToken ) diff --git a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.cs b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.cs index 23b35c29..5742bfec 100644 --- a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.cs +++ b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/MultipleBehaviorTest.cs @@ -14,9 +14,61 @@ public class MultipleBehaviorTest [assembly: Behaviors( typeof(LoggingBehavior<,>), - typeof(SecondLoggingBehavior<,>) + typeof(YetAnotherDummy.OtherBehavior<,>), + typeof(SecondLoggingBehavior<,>), + typeof(YetAnotherDummy.LoggingBehavior<,>), + typeof(YetAnotherDummy.SecondLoggingBehavior<,>) )] +namespace YetAnotherDummy +{ + public class User { } + public class UsersService + { + public Task> GetUsers() => + Task.FromResult(Enumerable.Empty()); + } + + public class OtherService + { + public Task> GetUsers() => + Task.FromResult(Enumerable.Empty()); + } + + public class OtherBehavior(ILogger> logger) + : Behavior + { + public override async Task HandleAsync(TRequest request, CancellationToken cancellationToken) + { + var response = await Next(request, cancellationToken); + + return response; + } + } + + public class LoggingBehavior(ILogger> logger) + : Behavior + { + public override async Task HandleAsync(TRequest request, CancellationToken cancellationToken) + { + var response = await Next(request, cancellationToken); + + return response; + } + } + + public class SecondLoggingBehavior(ILogger> logger) + : Behavior + { + public override async Task HandleAsync(TRequest request, CancellationToken cancellationToken) + { + var response = await Next(request, cancellationToken); + + return response; + } + } +} + namespace Dummy; public class GetUsersEndpoint(GetUsersQuery.Handler handler) diff --git a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs index a87df167..26a87dfd 100644 --- a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs +++ b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Msdi#Dummy.GetUsersQuery.g.verified.cs @@ -9,26 +9,26 @@ partial class GetUsersQuery { public sealed class Handler : global::Immediate.Handlers.Shared.IHandler> { - private readonly global::Dummy.GetUsersQuery.HandleBehavior _behavior_0; - private readonly global::Dummy.LoggingBehavior> _behavior_1; - + private readonly global::Dummy.GetUsersQuery.HandleBehavior _HandleBehavior; + private readonly global::Dummy.LoggingBehavior> _loggingBehavior; + public Handler( - global::Dummy.GetUsersQuery.HandleBehavior behavior_0, - global::Dummy.LoggingBehavior> behavior_1 + global::Dummy.GetUsersQuery.HandleBehavior HandleBehavior, + global::Dummy.LoggingBehavior> loggingBehavior ) { - _behavior_0 = behavior_0; - _behavior_1 = behavior_1; + _HandleBehavior = HandleBehavior; + _loggingBehavior = loggingBehavior; - _behavior_1.SetInnerHandler(_behavior_0); + _loggingBehavior.SetInnerHandler(_HandleBehavior); } - + public async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken = default ) { - return await _behavior_1 + return await _loggingBehavior .HandleAsync(request, cancellationToken) .ConfigureAwait(false); } @@ -38,14 +38,14 @@ public Handler( public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior> { private readonly global::Dummy.UsersService _usersService; - + public HandleBehavior( global::Dummy.UsersService usersService ) { _usersService = usersService; } - + public override async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken @@ -53,7 +53,7 @@ public HandleBehavior( { return await global::Dummy.GetUsersQuery .HandleAsync( - request, + request, _usersService, cancellationToken ) diff --git a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs index 5451082b..5c7527a5 100644 --- a/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs +++ b/tests/Immediate.Handlers.Tests/GeneratorTests/Behaviors/SingleBehaviorTest.SingleBehavior_assemblies=Normal#Dummy.GetUsersQuery.g.verified.cs @@ -7,26 +7,26 @@ partial class GetUsersQuery { public sealed class Handler : global::Immediate.Handlers.Shared.IHandler> { - private readonly global::Dummy.GetUsersQuery.HandleBehavior _behavior_0; - private readonly global::Dummy.LoggingBehavior> _behavior_1; - + private readonly global::Dummy.GetUsersQuery.HandleBehavior _HandleBehavior; + private readonly global::Dummy.LoggingBehavior> _loggingBehavior; + public Handler( - global::Dummy.GetUsersQuery.HandleBehavior behavior_0, - global::Dummy.LoggingBehavior> behavior_1 + global::Dummy.GetUsersQuery.HandleBehavior HandleBehavior, + global::Dummy.LoggingBehavior> loggingBehavior ) { - _behavior_0 = behavior_0; - _behavior_1 = behavior_1; + _HandleBehavior = HandleBehavior; + _loggingBehavior = loggingBehavior; - _behavior_1.SetInnerHandler(_behavior_0); + _loggingBehavior.SetInnerHandler(_HandleBehavior); } - + public async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken = default ) { - return await _behavior_1 + return await _loggingBehavior .HandleAsync(request, cancellationToken) .ConfigureAwait(false); } @@ -36,14 +36,14 @@ public Handler( public sealed class HandleBehavior : global::Immediate.Handlers.Shared.Behavior> { private readonly global::Dummy.UsersService _usersService; - + public HandleBehavior( global::Dummy.UsersService usersService ) { _usersService = usersService; } - + public override async global::System.Threading.Tasks.ValueTask> HandleAsync( global::Dummy.GetUsersQuery.Query request, global::System.Threading.CancellationToken cancellationToken @@ -51,7 +51,7 @@ public HandleBehavior( { return await global::Dummy.GetUsersQuery .HandleAsync( - request, + request, _usersService, cancellationToken )