Repository Pattern

A pattern that hides data storage behind a simple collection-like interface.

What is Repository Pattern?

The Repository pattern hides how data is stored behind a collection-like interface (GetById, Add, Remove). The rest of the app doesn't care whether it's SQL, a file or memory.

public interface IBookRepository
{
    Book? GetById(int id);
    void Add(Book book);
}

Level: Freelancer · More OOP terms at this level

Updated