Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1006951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:32:37+00:00 2026-05-16T08:32:37+00:00

Which layer should the repository classes go in? Domain or Infrastructure?

  • 0

Which layer should the repository classes go in? Domain or Infrastructure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:32:38+00:00Added an answer on May 16, 2026 at 8:32 am

    I guess that depends how You are going to rely on them.

    Question is – are You going to allow Yourself to use repositories from inside of domain?
    If so – then You are forced to put them in.

    I myself like to put them outside of domain. So – typical life cycle of something looks like this =>

    UI => Controller => retrieve aggregate root from repo => call logic through aggregate root => if new aggregate root created, add it to repo.

    Sometimes controller calls application service that does some additional stuff besides just retrieving root and calling function on it. But idea is same – domain knows nothing about persistence.


    While (as I see it) there’s nothing wrong with putting repos in domain (or at least abstractions of them), it makes Your domain more aware of persistence. Sometimes that can solve problems, but generally – that will definitely make Your domain more complex.

    Use what seems more natural for You and be ready to switch Your ways any time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a service, business and data access layer. In which layer should I
I am using a standard repository pattern with a service layer which calls the
Let's say I have an ASP.NET MVC webapp that calls a repository layer, which
I am trying to figure out which layer should be responsible for the caching
I have a business logic layer (the repository) which is exposed as a set
I'm building a repository layer for nhibernate, in which I have the following find
Following is part of service layer which is provided by WCF service : [Serializable]
I would like to unit test a DEPENDENT service layer which allows me to
List<CertMail> lsRecipetNumber = new List<CertMail>(); CertMail class is in data access layer which returns
I currently have 6 100mb+ PDF documents which have searchable text layer enabled. However

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.