- CQRS Øviv †evSvq Command Query Responsibility Segregation
- A‡b‡KB g‡b K‡ib CQRS GKwU architecture.
- wKš‘ bv |
- CQRS GKwU simple pattern hvnv architecture G A‡bK opportunities enable K‡i|
- Greg Young Ges Udi Dahan me©cÖ_g GB pattern introduce K‡ib|
- CQRS G command side I query side Gi method mg~n separate object G ivLv nq A_©vr command side Gi Rb¨ GKwU object Ges query side Gi Rb¨ Av‡iKwU object _vK‡e |
- cÖkœ n‡jv command I query wK?
o
Command side: †h mKj method mg~n object wKsev entire system Gi state change K‡i ZvnvB Command side method. Save(), Update(), Delete() etc. Command side
method
Kvib Bnv‡`i Øviv object Gi state change Kiv nq|
o
Query side: †h mKj method mg~n Øviv ïaygvÎ results return Kiv‡bv nq Ges Dnv‡`i Øviv object wKsev entire system Gi state Gi †Kvb change nq bv Zvnviv Query side
method. Get(), GetById() etc. Query side method Kvib Bnv‡`i Øviv ïaygvÎ results return Kiv‡bv nq Ges object Gi state Gi †Kvb change nq bv|
- mvavibZt Avgv‡`i Transactiona Class definition wb¤œiƒc nq-
EmployeeDataAccess
SaveEmployee(Employee employee)
UpdateEmployee(Employee employee)
DeleteEmployee(int employeeId)
PopulateEmployee()
PopulateEmployeeById(int employeeId)
- CQRS Pattern Abyhvqx Dc‡iv³ EmployeeDataAccess class wU‡K Dnvi method mg~‡ni responsibility Abyhvqx †f‡½ `yBwU fv‡M fvM Kiv n‡e-
- Command Side Gi Rb¨ EmployeeCommandDataAccess class hvnv wb‡¤œv³ method mg~n contain Ki‡e-
EmployeeCommandDataAccess
SaveEmployee(Employee employee)
UpdateEmployee(Employee employee)
DeleteEmployee(int employeeId)
- Query Side Gi Rb¨ EmployeeQueryDataAccess class hvnv wb‡¤œv³ method mg~n contain Ki‡e-
PopulateEmployee()
PopulateEmployeeById(int employeeId)
- BnvB CQRS pattern.