diff --git a/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs b/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs index 88f7d43..222081b 100644 --- a/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs @@ -7,19 +7,18 @@ using System.Text.Json; namespace ReC.Application.Common.Behaviors.Action; -public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPipelineBehavior +public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPipelineBehavior { - public async Task Handle(InvokeRecActionViewCommand request, RequestHandlerDelegate next, CancellationToken cancel) + public async Task Handle(InvokeRecActionViewCommand request, RequestHandlerDelegate next, CancellationToken cancel) { - var response = false; try { - response = await next(cancel); + await next(cancel); } catch { if (request.Action.ErrorAction == ErrorAction.Stop) - return false; + return Unit.Value; } string? info = null, error = null; @@ -44,6 +43,6 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi Error = error }, cancel); - return response; + return Unit.Value; } } \ No newline at end of file diff --git a/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs b/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs index c0dc973..7383c17 100644 --- a/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs @@ -7,9 +7,9 @@ using System.Text.Json; namespace ReC.Application.Common.Behaviors.Action; -public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPipelineBehavior +public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPipelineBehavior { - public async Task Handle(InvokeRecActionViewCommand request, RequestHandlerDelegate next, CancellationToken cancel) + public async Task Handle(InvokeRecActionViewCommand request, RequestHandlerDelegate next, CancellationToken cancel) { string? info = null, error = null; @@ -34,7 +34,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip }, cancel); if (error is not null && request.Action.ErrorAction == ErrorAction.Stop) - return false; + return Unit.Value; return await next(cancel); } diff --git a/src/ReC.Application/DependencyInjection.cs b/src/ReC.Application/DependencyInjection.cs index b311589..8017276 100644 --- a/src/ReC.Application/DependencyInjection.cs +++ b/src/ReC.Application/DependencyInjection.cs @@ -35,8 +35,8 @@ public static class DependencyInjection cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()); cfg.AddOpenBehaviors([typeof(BodyQueryBehavior<,>), typeof(HeaderQueryBehavior<,>)]); cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>)); - cfg.AddBehavior(typeof(IPipelineBehavior), typeof(PostprocessingBehavior)); - cfg.AddBehavior(typeof(IPipelineBehavior), typeof(PreprocessingBehavior)); + cfg.AddBehavior(typeof(IPipelineBehavior), typeof(PostprocessingBehavior)); + cfg.AddBehavior(typeof(IPipelineBehavior), typeof(PreprocessingBehavior)); cfg.LicenseKey = configOpt.LuckyPennySoftwareLicenseKey; });