Request And ResponseΒΆ

Create request and response objects. By inheriting from IRequest<TResponse> mediator will know the type of object being returned.

namespace Example.League.Api.Team
{
    using Miruken.Mediate.Api;

    public class CreateTeam : IRequest<TeamResult>
    {
        public Team Team { get; set; }
    }
}
namespace Example.League.Api.Team
{
    public class TeamResult
    {
        public Team Team { get; set; }
    }
}

IRequest<TResponse> is optional. Mediator will still handle your request without it, but you will have to specify the return type when sending the message.

namespace Example.WithPureClasses
{
    using League.Api.Team;

    public class CreateTeam
    {
        public Team Team { get; set; }
    }
}

Responses are also optional. You can send requests that have no response.