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 3483572
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:41:24+00:00 2026-05-18T10:41:24+00:00

My apology as this question is difficult to express with nice words. I have

  • 0

My apology as this question is difficult to express with nice words.

I have question similar to this.

Is it violation of Repository Pattern? to use Reposiotry created for Product is used to get all Categories?

        viewModel.Categories= productRepository.FindAll<Category>(c => c.Id > 0).ToList();//is it Correct with Pattern

Though I can get similar result with this also,

        viewModel.Categories = categoryRepository.GetAll();// getting Categories by creating new instance of categoryRepository

In above example I need to show categories on Product view, only diplay no crud(unit of work) will be done on Category.
So what is best practice here?

Thnaks,

  • 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-18T10:41:25+00:00Added an answer on May 18, 2026 at 10:41 am

    As mentioned in this post, you probably want to have a ServiceLayer in between. The service layer is responsible to decouple meta logic from your controller. As your code grows more complex, there will be a need for repositories knowing each other, which is not good. For a service, however, it’s perfectly OK. Repositories then are very light-weight and have no understanding of the business logic.

    The ServiceLayer, however, has. For example, if there is no Categories Collection/Table, but the Categories are embedded in the Products, there shouldn’t be a CategoryRepository that pretends. A ProductService could suplly a method AllCategories(), however.

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

Sidebar

Related Questions

Please let me preface this question with an apology. I am very new to
I have an ImageButton, which should contain the text. For this I use LayerDrawable
First, I apology for this newbie question. I'm new in Objective C and OpenCV
First off, an apology as I am sure this is question's answer is quite
First of all I would like apology if this question has already been answered,
Let me know if I have to make this more concise, if you don't
Firstly, an apology for the length of this post. If brevity is the soul
I have been trying different solutions for this problem without success. Problem is this:
My Question is little bit bigger so apology for that. Now my problem is
My apology for such a noob question. On my hosting server, there are two

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.