question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make service layer independent of persistence framework

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shuebnercommented, Feb 6, 2018

My employer gave me permission. I will try to upload my (not great) code today. How can I reach you?

0reactions
jaredcnancecommented, Feb 8, 2018

awesome! you can DM me on the project’s Gitter site

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found