(one repository per Entity): Custom repository class for each entity, eg: UserRepository, EmployeeRepository.
(one repository for all Entity): Is an implementation of Repository pattern that allows us to create a single repository that can be used for multiple entities. Instead of writing sperate repositories for each entity, GR uses a single class with Generic type T parameter to handle CRUD. Simplifies DAL by reducing duplicate logic.
Controller (API Layer): Handles incoming HTTP requests and routes them to the appropriate
service methods. It acts as a bridge between the client (frontend) and the BL. Example: GET
`/api/employees/{id}` calls `EmployeeService.GetById(id)`.
Service (Business Logic Layer): Contains the core business logic and coordinates between
the controller and the repository. Validates input, applies rules, and processes data before
passing to/from the data layer.
Repository (Data Access Layer): Handles all interactions with the database. Encapsulates
querying, inserting, updating, and deleting data. It allows services to work with data without
knowing the source
Entity + DTO:
- Entity: Represents the real database model (e.g., `Employee`) used with EF Core.
- DTO (Data Transfer Object): A simplified version of Entity for transferring data
between layers, especially to/from API.



Controller (API Layer): This is the entry point of your application. It handles HTTP
requests and responses. Calls methods from the Service Layer to execute business logic
Service (Business Logic Layer): Contains business logic and rules for handling
application operations. Interacts with the Generic Repository to get or manipulate data.
Repository (Data Access Layer): Generic Repository handles all CRUD operations for any
entity. You do not write a separate repository for each entity, ensure DRY principle.




Used to manage changes to multiple entities in a DB as a single Transaction (operation). If we want to implement transaction while using EF and RP, then UOF can be effective implementation of RP.
Controller (API Layer): Entry point handling HTTP requests/responses.
Service (Business Logic Layer): Uses UoW to coordinate multiple repository
operations.
Repository (Data Access Layer+UOW): Repositories don’t call SaveChanges() directly.
Instead, they only perform data operation. The Unit of Work will call SaveChanges() once.




We want to transfer money between two accounts. If debit from Account A or credit to Account B fails, the transaction must roll back.

