Provides an abstraction of data, so that your application can work with a simple abstraction that has an interface approximating that of a collection. Adding, removing, updating, and selecting items from this collection is done through a series of straightforward methods, without the need to deal with database.
Allows your applications to perform CRUD-like operations.
public interface IRepository where T : EntityBase
{
T GetById(int id);
IEnumerable List();
IEnumerable List(Expression> predicate);
void Add(T entity);
void Delete(T entity);
void Edit(T entity);
}
Sources:
Comments