Adds Generic CommandHandlerDecorator
This commit is contained in:
parent
49f9b99ee1
commit
64e696dc5a
21 changed files with 131 additions and 110 deletions
|
|
@ -1,13 +1,14 @@
|
|||
using Autofac;
|
||||
using PlanTempus.Components.Users.Create;
|
||||
using PlanTempus.Core.CommandQueries;
|
||||
|
||||
namespace PlanTempus.Components;
|
||||
|
||||
public class CommandHandler(IComponentContext context) : ICommandHandler
|
||||
{
|
||||
public async Task<TCommandResult> Handle<TCommand, TCommandResult>(TCommand command)
|
||||
public async Task<CommandResponse> Handle<TCommand>(TCommand command) where TCommand : ICommand
|
||||
{
|
||||
var handler = context.Resolve<ICommandHandler<TCommand, TCommandResult>>();
|
||||
var handler = context.Resolve<ICommandHandler<TCommand>>();
|
||||
return await handler.Handle(command);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue