Message types

In mediate we have two kinds of messages that represent different things:

Query

A query is a message that returns a response. You can think of a query like a question that receives an answer.

Note

A concrete query can only have a one concrete handler.

A query is defined by the IQuery generic interface

/// <summary>
/// Marker interface for defining a query with a response
/// </summary>
/// <typeparam name="TResult">Query response type</typeparam>
public interface IQuery<out TResult>
{
}

Event

An event is a message without response. You can think of an event like a notification that inform someone that something has happened.

Note

A concrete event can have multiple concrete handlers.

An event is defined by the IEvent interface

/// <summary>
/// Marker interface for defining an event
/// </summary>
public interface IEvent
{
}