You are on page 1of 2

Repository Pattern:

Bao gồm các phương thức để các Controller khác kế thừa.

Repository Pattern nằm giữa DataAccess và Business Logic, là lớp trung gian giữa truy cập dữ liệu và xử lý logic.

 Giúp cho việc bảo mật chặt chẽ hơn.

Với repository pattern, vì nó nằm giữa Controller và Model nên cách sử dụng sẽ là

- Gửi Request đến Controller


- Controller yêu cầu Repository lấy dữ liệu
- Repository gọi Model để lấy data VÀ xử lý data ngay tại repository.
 Controller muốn lấy dữ liệu thì gọi repository.

Unit of Work.

The Unit of Work class coordinates the work of multiple repositories by creating a single database context class
shared by all of them.

You might also like