Repository and query objects pattern. How to implement complex queries

c# design-patterns entity-framework sql

Accepted Answer

ZZZ_tmp
3
3/17/2015 6:53:26 AM

Popular Answer

The Repository pattern is effective for CRUD applications that are commonplace. when a single database table requires the traditional set of creation, read, update, and delete activities to be implemented. If so, you should construct a repository for each table and permit read operations to accept extra values to enable filtering.

The Work Unit pattern is the following pattern above. These are utilized to conduct business processes across many repositories. As an illustration, reading values from various sources, performing calculations, and writing back modifications to various repositories are all examples of how to do it. To ensure that the database always has a consistent state, all of that would take place within a transaction.

The issue arises when you have intricate queries that span several tables. The query would then be entered into the repository that contains the first table in the query's from clause. The repository method would then require parameters so that it could be parameterized as necessary.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow