Skip to content
TheDumbTechGuy edited this page Jun 27, 2017 · 3 revisions

Commands

class TestCommand : ICommand { }

class TestCommandHandler : ICommandHandler<TestCommand>
{
    public async Task Handle(TestCommand command)
    {
        Console.WriteLine("Test command handler");
    }
}

Events

class TestEvent : IEvent { }

class TestEventHandler : ICommandHandler<TestEvent>
{
    public async Task Handle(TestEvent testEvent)
    {
        Console.WriteLine("Test even thandler");
    }
}

Queries

class TestResult { }

class TestQuery : IQuery<TestQuery, TestResult> { }

class TestQueryHandler : IQueryHandler<TestQuery, TestResult>
{
    public async Task<TestResult> Handle(TestQuery testQuery)
    {
        return new TestResult();
    }
}

Message

class Message { }

class TestMessageHandler : IMessageHandler<Message>
{
    public async Task<Unit> Handle(Message message)
    {
        return Unit.Unit;
    }
}
Clone this wiki locally