Files
EnvelopeGenerator/EnvelopeGenerator.Application/Signatures/Behaviors/AnnotationBehavior.cs
TekH 9174065365 Pass cancellationToken to next() in pipeline behaviors
Updated the `Handle` method in multiple classes implementing
`IPipelineBehavior<SignCommand, Unit>` to pass the `cancellationToken`
parameter to the `next()` method. This change ensures consistent
propagation of the `cancellationToken` through the pipeline, enabling
proper handling of cancellation requests during asynchronous operations.

Modified files:
- AnnotationBehavior.cs
- DocStatusBehavior.cs
- HistoryBehavior.cs
- SendSignedMailBehavior.cs
2026-06-09 19:07:38 +02:00

42 lines
1.3 KiB
C#

using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Application.Signatures.Commands;
using EnvelopeGenerator.Domain.Entities;
using MediatR;
namespace EnvelopeGenerator.Application.Signatures.Behaviors;
/// <summary>
/// Pipeline behavior that saves annotations.
/// Executes first in the signing process.
/// </summary>
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
public class AnnotationBehavior : IPipelineBehavior<SignCommand, Unit>
{
private readonly IRepository<ElementAnnotation> _repo;
/// <summary>
///
/// </summary>
/// <param name="repository"></param>
public AnnotationBehavior(IRepository<ElementAnnotation> repository)
{
_repo = repository;
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="next"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task<Unit> Handle(SignCommand request, RequestHandlerDelegate<Unit> next, CancellationToken cancellationToken)
{
if (request.PsPdfKitAnnotation is PsPdfKitAnnotation annot)
await _repo.CreateAsync(annot.Structured, cancellationToken);
return await next(cancellationToken);
}
}