hopefully not a horribly foolish refactoring
This commit is contained in:
parent
59d660165f
commit
1ecaf64dea
82 changed files with 782 additions and 398 deletions
25
Femto.Modules.Media/Application/MediaModule.cs
Normal file
25
Femto.Modules.Media/Application/MediaModule.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using Femto.Common.Domain;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Femto.Modules.Media.Application;
|
||||
|
||||
public class MediaModule(IHost host) : IMediaModule
|
||||
{
|
||||
public async Task<TResult> PostCommand<TResult>(ICommand<TResult> command)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
var response = await mediator.Send(command);
|
||||
return response;
|
||||
}
|
||||
|
||||
public async Task<TResult> PostQuery<TResult>(IQuery<TResult> query)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
var response = await mediator.Send(query);
|
||||
return response;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue