Make service layer independent of persistence framework
See original GitHub issueI am currently writing an IEntityRepository implementation for MongoDB, for which there is no EF support.
The code for Filter
and Sort
is the same and PageAsync
only differs in its query realization in that instead of ToListAsync()
it is ToAsyncEnumerable().ToList()
.
To avoid code duplication for those methods I suggest adding an abstract class that handles Filter
, Sort
and PageAsync
for all DB drivers that can provide an IQueryable<>
, with an abstract method for DB-specific query realization.
That abstract class would only depend on IJsonApiContext.
Alternatively the query realization could be in its own interface for DI.
What do you think?
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Designing the infrastructure persistence layer
Data persistence components provide access to the data hosted within the boundaries of a microservice (that is, a microservice's database). They ...
Read more >1. Layered Architecture - Software Architecture Patterns ...
In the following example, since the services layer is open, the business layer is now allowed to bypass it and go directly to...
Read more >How to Implement Layered Architecture - Level Up Coding
For example, the persistence layer already hides the details about data storage, so it's not the job of the service layer. Let's come...
Read more >Architecture Pitfalls: Don't let your persistence layer bleed ...
Consider creating a representation that consumers of your persistence layer should see that is independent of your persistence model — i.e. a set...
Read more >About layered architecture and the persistence layer
The idea is to implement any persistence-related methods not inside the domain object, or some god-class-like "datastore" object, but inside ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My employer gave me permission. I will try to upload my (not great) code today. How can I reach you?
awesome! you can DM me on the project’s Gitter site