dotnet add package Mediatron
services.AddMediatron(
Assembly.GetExecutingAssembly()
);
var mediator =
serviceProvider.GetRequiredService<IMediator>();
int newId =
await mediator.SendAsync<CreateProductCommand, int>(
command
);
await mediator.SendAsync(
new DeleteProductCommand(newId)
);
await mediator.PublishAsync(
new ProductCreatedNotification(productId)
);