using Femto.Common.Domain; using MediatR; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace Femto.Modules.Blog.Application; internal class BlogModule(IHost host) : IBlogModule { public async Task PostCommand(ICommand command, CancellationToken cancellationToken = default) { using var scope = host.Services.CreateScope(); var mediator = scope.ServiceProvider.GetRequiredService(); await mediator.Send(command, cancellationToken); } public async Task PostCommand( ICommand command, CancellationToken cancellationToken = default ) { using var scope = host.Services.CreateScope(); var mediator = scope.ServiceProvider.GetRequiredService(); var response = await mediator.Send(command, cancellationToken); return response; } public async Task PostQuery( IQuery query, CancellationToken cancellationToken = default ) { using var scope = host.Services.CreateScope(); var mediator = scope.ServiceProvider.GetRequiredService(); var response = await mediator.Send(query, cancellationToken); return response; } }