move the behaviours about pdf to pdf dir
This commit is contained in:
parent
c6a99b56a2
commit
67d0980c63
@ -11,7 +11,7 @@ using Microsoft.Extensions.Options;
|
||||
using QRCoder;
|
||||
using System.Reflection;
|
||||
using GdPicture14;
|
||||
using EnvelopeGenerator.Application.Common.Behaviors;
|
||||
using EnvelopeGenerator.Application.Pdf.Behaviors;
|
||||
|
||||
namespace EnvelopeGenerator.Application;
|
||||
|
||||
@ -87,7 +87,7 @@ public static class DependencyInjection
|
||||
services.AddMediatR(cfg =>
|
||||
{
|
||||
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
|
||||
cfg.AddBehavior<SaveBurnedPdfBehavior>();
|
||||
cfg.AddOpenBehaviors(new Type[] { typeof(AddReportBehavior), typeof(SavePdfBehavior) });
|
||||
});
|
||||
|
||||
// Add memory cache
|
||||
|
||||
@ -33,8 +33,6 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="System.Formats.Asn1" Version="8.0.2" />
|
||||
<PackageReference Include="GdPicture" Version="14.3.19.1" />
|
||||
<PackageReference Include="GdPicture.runtimes.windows" Version="14.3.19.1" />
|
||||
<PackageReference Include="GdPicture.runtimes.linux" Version="14.3.19.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
using EnvelopeGenerator.Application.Pdf;
|
||||
using MediatR;
|
||||
using Org.BouncyCastle.Utilities;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.Behaviors;
|
||||
namespace EnvelopeGenerator.Application.Pdf.Behaviors;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SaveBurnedPdfBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
||||
public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
@ -0,0 +1,23 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Pdf.Behaviors;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SavePdfBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="next"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<byte[]> Handle(BurnPdfCommand request, RequestHandlerDelegate<byte[]> next, CancellationToken cancel)
|
||||
{
|
||||
var docResult = await next(cancel);
|
||||
var base64 = Convert.ToBase64String(docResult);
|
||||
return docResult;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user