0% found this document useful (0 votes)
4 views9 pages

Generic Repository and Unit of Work Explained

The document discusses the Generic Repository and Unit of Work patterns, emphasizing the importance of the DRY principle in software development. It highlights the benefits of using the Repository Pattern for centralizing data logic, facilitating unit testing, and providing a flexible architecture. Additionally, it explains how the Unit of Work pattern coordinates multiple repositories with a shared database context to streamline data access.

Uploaded by

mprathap102
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

Generic Repository and Unit of Work Explained

The document discusses the Generic Repository and Unit of Work patterns, emphasizing the importance of the DRY principle in software development. It highlights the benefits of using the Repository Pattern for centralizing data logic, facilitating unit testing, and providing a flexible architecture. Additionally, it explains how the Unit of Work pattern coordinates multiple repositories with a shared database context to streamline data access.

Uploaded by

mprathap102
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

GENERIC REPOSITORY

AND
UNIT OF WORK
DRY?

Don’t Repeat Yourself, means don’t repeat your code.


Use Generic Repository to implement DRY.
Repository Pattern
 Mediator between BLL(Business Logic Layer) &
DAL(Data Access Layer).
 Separation layer between Data and Domain Layer.
Benefits of Repository Pattern
It centralizes data logic or business logic and service
logic.
It gives a substitution point for the unit tests.
Provides a flexible architecture.
If you want to modify the data access logic or
business access logic, you don’t need to change the
repository logic
What is Generic Repository
Pattern?
◦Generally -one repository for one model to access
data.
◦What if Single Repository for all.
◦Single Repository for data access of models.
Benefits of Generic Repository
Pattern
It reduces redundancy of code.(No longer needed)
It force programmer to work using the same pattern.
It creates possibility of less error.
If you use this pattern then it is easy to maintain the
centralized data access logic.
Unit Of Work
◦The Unit of Work Class co-ordinates the work of
multiple repositories by creating a single database
context class shared by all of them.
Benefits of Unit of Work
◦There is a common Dbcontext for all repository.
◦Without Unit of Work there will be separate
DbContext object for each repository.

You might also like