We will streamline the implementation while implementing commands in our repository. The following code will allow us to create an interface which enforces IncludeData to be set for all queries:
public interface IQueryRoot
{
bool IncludeData { get; set; }
}
We will use IQueryRoot as a base interface for the query handler, which returns generic return typed data. The following code extends the IQueryRoot and provide two interfaces to support synchronous and asynchronous operations:
public interface IQueryHandler<out TReturn> : IQueryRoot
{
TReturn Handle();
}
public interface IQueryHandlerAsync<TReturn> : IQueryRoot
{
Task<TReturn> HandleAsync();
}
Let's keep creating multiple generic interfaces required for different queries that inherit the query handler with a configured...