The Repository Design Pattern in C# Mediates
between the domain and the data mapping layers using a collection-like
interface for accessing the domain objects.
In other words, we can say that a Repository Design
Pattern work as a middle layer between the rest of the application and
the data access logic. That means a repository pattern isolates all the data
access code from the rest of the application. The advantage of doing so is that,
if you need to do any change then you need to do in one place. Another
benefit is that testing your controllers becomes easy because the testing
framework need not run against the real database access code.