Upgrade MediatR to 12.5.0 and forward cancellation tokens through pipeline behaviors (#320)

This commit is contained in:
Aaron Po
2026-09-26 19:50:44 -04:00
committed by GitHub
parent 0ff42c3c70
commit e1b6cba1d4
7 changed files with 21 additions and 30 deletions

View File

@@ -67,7 +67,7 @@ public partial class UnhandledExceptionLoggingBehavior<TRequest, TResponse>
{
try
{
return await next();
return await next(cancellationToken);
}
catch (ValidationException)
{
@@ -78,7 +78,7 @@ public partial class UnhandledExceptionLoggingBehavior<TRequest, TResponse>
{
if (_logger.IsEnabled(LogLevel.Error))
LogUnhandledException(ex, typeof(TRequest).Name, Serialize(request));
throw;
}
}

View File

@@ -21,7 +21,7 @@ public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TReq
)
{
if (!validators.Any())
return await next();
return await next(cancellationToken);
ValidationContext<TRequest> context = new(request);
@@ -35,6 +35,6 @@ public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TReq
if (failures.Count > 0)
throw new ValidationException(failures);
return await next();
return await next(cancellationToken);
}
}

View File

@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="FluentValidation" Version="11.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
</ItemGroup>