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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:40:06+00:00 2026-05-20T10:40:06+00:00

I have seen many repository pattern implementations. Specifically of 2 types They expose the

  • 0

I have seen many repository pattern implementations. Specifically of 2 types

  1. They expose the generic repository which is queryable and expects a lamba expression from service class to get data from database.

  2. Write methods to get the data from database based on business requirements and encapsulate the logic (even lambda) of retrieving the data.

Which one is a better approach?

  • 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-20T10:40:07+00:00Added an answer on May 20, 2026 at 10:40 am

    I really prefer the second one.

    Even I’ve seen articles from top bloggers on .NET world, queryables, for me, are evil in a repository.

    Reasons:

    1. A repository is like a collection of objects but stored wherever its implementation has defined.

    2. A repository abstracts the way data is mapped to object. Data store could be whatever, but business relies on repository in order to retrieve, add, update or remove domain objects.

    3. Any read or write access to the underlying store must be managed by the repository itself – or any other underlying layer -.

    Queryable destroys most of these points and/or reasons.

    For example, why you would design a GetProductByName, GetProductByCode, if you can do it with LINQ on IQueryable?

    And Queryable works bad in n-tier scenarios, since you won’t be having access to the database connection in another tier than the one which returned a deferred set.

    I don’t think “queryable” concept and repository should be good for any software design, because it’s telling that repository is useless.

    Queryable is like designing a GetAll method. What’s the point of a GetAll in a repository? Repository will be retrieving all domain objects and you’ll be filtering them in business. But… Wait… Repository isn’t supposed to retrieve domain objects with some criteria, is it?

    Although I find queryable incompatible with repository, designing and implementing some repository method that accepts a lambda expression or any delegate in order to give some kind of filter or behavior, for me, is fine. This isn’t deferred execution, it’s delegation.

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

Sidebar

Related Questions

Many times I have seen Visual Studio solutions which have multiple projects that share
I have seen many programs consisting of structures like the one below typedef struct
I have seen many examples, with many 'no, you missed something' comments. What is
I have seen many apps that take instrument classes and take -javaagent as a
I have seen simple example Ajax source codes in many online tutorials. What I
I have seen this problem arise in many different circumstances and would like to
Haven't seen many Geneva related questions yet, I have posted this question in the
I've seen (and used) code to have a link spawn a javascript action many
I have seen examples of printing from a windows application but I have not
I have seen lots of questions recently about WPF... What is it? What does

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.