For a simple application, it is feasible to use ORM instead of Repository. However, in an enterprise application, the domain object is not one-to-one mapping to a table or some rows. A domain object is composed of many data, and there are rich constraints between the data. This is also called Impedance Mismatch.
In order to solve the mismatch, we usually introduce a Repository between the domain layer and storage layer. Repository is not only responsible for accessing the data but also ensure the data constraints.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For a simple application, it is feasible to use ORM instead of Repository. However, in an enterprise application, the domain object is not one-to-one mapping to a table or some rows. A domain object is composed of many data, and there are rich constraints between the data. This is also called Impedance Mismatch.
In order to solve the mismatch, we usually introduce a Repository between the domain layer and storage layer. Repository is not only responsible for accessing the data but also ensure the data constraints.