Generic Repository in C#


In this lesson, we’ll learn how to use Container to perform the classic CRUD operations on a document:

  • Create

  • Read

  • Update

  • Delete

Generic repository

Most operations on documents are independent of the container. For this reason, we’ll implement a generic repository.

Let’s start creating two files in a Repositories folder in the GameStore.Repositories namespace:

  • IRepository.cs

  • Repository.cs

Get hands-on with 1200+ tech skills courses.