Skip to content

Instantly share code, notes, and snippets.

@mendicantx
Created February 28, 2012 17:41
Show Gist options
  • Save mendicantx/1933895 to your computer and use it in GitHub Desktop.
Save mendicantx/1933895 to your computer and use it in GitHub Desktop.
Repository
public interface IRepository
{
TEntity Get<TEntity>(Guid id) where TEntity : IEntity;
TEntity FindOne<Query, TEntity, Tparam>(Tparam param) where Query : ISingleItemQuery<TEntity, Tparam>, new();
IEnumerable<TEntity> FindAllFor<Query, TEntity, TParameter>(TParameter parameter)
where Query : IFindAllQuery<TEntity, TParameter>, new()
where TEntity : IEntity;
void Save<TEntity>(TEntity entity) where TEntity : IEntity;
void Delete<TEntity>(TEntity entity) where TEntity : IEntity;
}
public interface ISingleItemQuery<TEntity, TParam>
{
TEntity RunAgainst(ISession session, TParam param);
}
public interface IFindAllQuery<out TEntity, in TParameter>
{
IEnumerable<TEntity> FindUsing(ISession session, TParameter parameter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment