Simplified the `Handle` method by removing the `async` modifier and replacing the `await` call with a direct `return` statement for `repo.DeleteAsync`. This optimization eliminates the overhead of creating an async state machine, as no additional asynchronous operations or logic are performed in the method.
18 lines
549 B
C#
18 lines
549 B
C#
using DigitalData.Core.Abstraction.Application.Repository;
|
|
using MediatR;
|
|
using ReC.Domain.Entities;
|
|
|
|
namespace ReC.Application.RecActions.Commands;
|
|
|
|
public class DeleteRecActionsCommand : IRequest
|
|
{
|
|
public long ProfileId { get; init; } = 2;
|
|
}
|
|
|
|
public class DeleteRecActionsCommandHandler(IRepository<RecAction> repo) : IRequestHandler<DeleteRecActionsCommand>
|
|
{
|
|
public Task Handle(DeleteRecActionsCommand request, CancellationToken cancel)
|
|
{
|
|
return repo.DeleteAsync(act => act.ProfileId == request.ProfileId, cancel);
|
|
}
|
|
} |