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

  • SEARCH
  • Home
  • 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 7545399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:55:08+00:00 2026-05-30T08:55:08+00:00

First of all there is probably no correct answer, but I’m sure there are

  • 0

First of all there is probably no correct answer, but I’m sure there are people who knows more than me and will be able to assist.

I have 3 entities: User, Blog, Post.

The system can have any number of users.

User can have any number of blogs, but each blog have only one user.

Blog can have as many posts as the user will post, and all posts will be from the same user that owns the blog (i.e. if John owns blog Food, only John can post in this blog). And of course each post have one parent blog.

Then I have the user profile page, where I want to display all the user details, names of all his blogs, and last 5 posts.

I have then a blog page that displays details of the blog, the name of the owner (User) and titles of all posts.

Then I have post page that displays the post details, blog name and owner name.

As you see I have relations between all of them, but none of them can act as aggregate.

Its not that hard to define the entities in code, what I do have issues with is defining the repositories. How much do I need? 3 – one per each entity? 1 – for everything? How do I perform look-up?

For example to get the 5 last posts in the user page. User does not have reference to Posts, instead in holds a container of Blogs where each Blog in turn holds container of Posts. Should I have a method in my repository that accepts the UserID and returns a list of Posts? Or maybe it should be a Service? Also I don’t usually perform loading of all the data but instead I have lazy loading. By retrieving an existing User entity, I would not load its blogs unless they are needed (when first time accessed).

  • 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-30T08:55:09+00:00Added an answer on May 30, 2026 at 8:55 am

    I would create:

    • a PostRepository used to handle posts and comments
    • BlogRepository used mostly for searching
    • UserRepository

    If you are not going to support comments I would remove the post repository and handle posts in the BlogRepository

    I usually model the repositories after their usage and to avoid nesting of aggregates (more than two levels).

    For example to get the 5 last posts in the user page. User does not have reference to Posts, instead in holds a container of Blogs where each Blog in turn holds container of Posts.

    imho the user should not have a container to the Blog. You have the repository to fetch it.

    Should I have a method in my repository that accepts the UserID and returns a list of Posts?

    yes.

    Or maybe it should be a Service?

    Service is used to remove business logic from the code that uses the domain models. Don’t create them until you get that kind of logic.

    Also I don’t usually perform loading of all the data but instead I have lazy loading. By retrieving an existing User entity, I would not load its blogs unless they are needed (when first time accessed).

    Lazy loading can be avoided by not having properties that link all domain models together. Try to only have properties to child aggregates.

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

Sidebar

Related Questions

First of all there is probably a question like this already but i couldn't
All, This question probably has a very simple answer - something I'm overlooking. But
First of all, I apologize to post this easy question. Probably there is a
There is probably a very simple fix to this, but i'm all new with
First of all: I do know that there are already many questions and answers
First of all, there are many cases where Sleep() is misused , for example
First of all, I know there are a few quite similar questions here on
First of all i have frames on my SD Card and frames are there
First of all, to clarify my goal: There exist two programs written in C
I want to intercept all route changes with Sammy to first check if there

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.