Skip to content

Instantly share code, notes, and snippets.

@ScottGuymer
Last active October 24, 2015 13:13
Show Gist options
  • Save ScottGuymer/e167989e2f5985e2629e to your computer and use it in GitHub Desktop.
Save ScottGuymer/e167989e2f5985e2629e to your computer and use it in GitHub Desktop.
Design Patterns and Useful Methods
public interface ICommandHandler<TCommand> where TCommand : ICommand
{
void Handle(TCommand command);
}
public interface ICommand
{
}
public interface IQueryHandler<TQuery, TResult> where TQuery : IQuery<TResult>
{
TResult Handle(TQuery query);
}
public interface IQuery<TResult>
{
}
using System.Linq;
/// <summary>
/// An Interface to define a selector query that is used to return data from the database.
/// </summary>
/// <typeparam name="TIn">The type of the input to the query.</typeparam>
/// <typeparam name="TOut">The type of the output from the query.</typeparam>
public interface ISelect<in TIn, out TOut>
{
TOut Run(IQueryable<TIn> objects);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment