initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Indotalent.Infrastructure.Database;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Indotalent.Features.Serilogs.Database;
|
||||
|
||||
|
||||
|
||||
|
||||
public record DeleteSerilogLogsAllCommand() : IRequest<bool>;
|
||||
|
||||
public class DeleteSerilogLogsHandler :
|
||||
IRequestHandler<DeleteSerilogLogsAllCommand, bool>
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
|
||||
public DeleteSerilogLogsHandler(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> Handle(DeleteSerilogLogsAllCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
await _context.Database.ExecuteSqlRawAsync("TRUNCATE TABLE SerilogLogs", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user