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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:47:05+00:00 2026-05-22T22:47:05+00:00

Regarding the contract between the domain and repository, I gather it’s best to avoid

  • 0

Regarding the contract between the domain and repository, I gather it’s best to avoid an all-encompassing generic IRepository interface with methods such as Create() and Delete()? Unless, of course, it’s natural to have these methods available for all the entities I’m working with. Which I imagine is a rare scenario.

Instead, should I create a basic IRepository contract with as many – perhaps “as few” would be more appropriate – common methods (e.g., GetByID()) as makes sense? All repositories could implement the contract and then specialize.

Or is it better to go the route of multiple specialized interfaces, à la ICreatable, IDeletable, IRetrievable, etc.?

  • 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-22T22:47:06+00:00Added an answer on May 22, 2026 at 10:47 pm

    I think you should only create an basic IRepository if the methods within the interface are used by all repositories. If you have some repositories that will implement only a part of the methods, than you should go for the more specialized interfaces.

    Also the last option will give you more flexibility in adding behaviour later to your repository when needed. If you use the basic IRepository interface and have to add a new method to it, than you will have to update all repositories. If you use the specialized version than you only have to update the repositories to which you want to apply this behaviour.

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

Sidebar

Related Questions

I'm looking for best practices regarding abstracting my RIA domain context away from my
I'd like to enforce a struct to always be valid regarding a certain contract,
I have several questions regarding code contracts, and the best practices for their usage.
Regarding the same program as my question a few minutes ago ... I added
Regarding cross-site request forgery (CSRF) attacks, if cookies are most used authentication method, why
Regarding the classic test pattern of Arrange-Act-Assert , I frequently find myself adding a
Regarding separations of concerns only, are there advantages of using ASP.NET MVC instead of
Regarding TJvRichEdit and Delphi... How? Load/Save rtf (including text and images - not only
Regarding the following C++ program: class Base { }; class Child : public Base
Regarding the worker pool, what happens when the computer restarts? Does the worker continue

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.