© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
45 replies
Edup

Repository Pattern and Clean Architecture

Whenever we perform a query, the ideal approach is to return only the necessary columns.
However, whenever I see content about repositories, the SELECT is always done using the entity. In other words, the entire entity is selected from the database.

In my projects, I create responses or DTOs. But DTOs are recommended in the application layer, while repository interfaces belong to the domain layer.

Of course, I could map the entity to a DTO to protect sensitive data.
However, I would still be loading all the data from the database, including many unnecessary fields.

For example, in an online store:
On the homepage, we only display promotional products with their price, title, and image. It doesn't make sense to fetch the entire product description from the database.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Clean Architecture
C#CC# / help
17mo ago
Clean Architecture
C#CC# / help
3y ago
✅ CQRS and Repository pattern
C#CC# / help
4mo ago
Solution Clean Architecture
C#CC# / help
7mo ago