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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:54:27+00:00 2026-05-14T00:54:27+00:00

It makes sense to pass a filter object to the repository so it can

  • 0

It makes sense to pass a filter object to the repository so it can limit what records return:

var myFilterObject = myFilterFactory.GetBlank();
myFilterObject.AddFilter( new Filter { "transmission", "eq", "Automatic"} );
var myCars = myRepository.GetCars(myfilterObject);

Key question: how would you implement paging and where? Any links on how to return a LazyList from a Repository as it would apply here? Would this be part of the filter object? Something like:

myFilterObject.AddFilter( new Filter { "StartAtRecord", "eq", "45"} );
myFilterObject.AddFilter( new Filter { "GetQuantity", "eq", "15"} );
var myCars = myRepository.GetCars(myfilterObject);

I assume the repository must implement filtering, otherwise you would get all records.

  • 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-14T00:54:28+00:00Added an answer on May 14, 2026 at 12:54 am

    I implement paging/sorting in my service layer. I think some people would disagree with this, but it works great for me. Make sure your repository returns an IQueryable though.

    public class ProductService
    {
       private IRepository<Product> Products {get; set;}

    public IEnumerable<ProductDto> GetProductsMatching(FilterCriteria criteria)
    {
    var products = Products.Query()
    .Where( // do filtering )
    .OrderBy( // order by )
    .Skip(criteria.PageSize * criteria.CurrentPage)
    .Take(criteria.PageSize);
    var dtos = products.Select( // do mapping );
    return dtos;
    }
    }

    How you return a LazyList/IQueryable depends on what ORM you are using. I am only familiar with NHibernate (use Linq to NHibernate) and Linq2Sql.

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

Sidebar

Related Questions

I want to create a script that parses or makes sense of apache's error
I am wondering if including image thumbnail information in the model makes sense. Like
I am just getting started with expression trees so I hope this makes sense.
I personally like the exclusive or , ^ , operator when it makes sense
I understand that the goal of moving towards <div> tags from <table> makes sense
Apologies if any of what I'm about to say makes no sense or overlooks
Is there a particular scenario where a WriteOnly property makes more sense then a
In C++, sizeof('a') == sizeof(char) == 1 . This makes intuitive sense, since 'a'
Which method makes the most sense for importing a module in python that is
Here's a quicky question. Which method name makes the most sense for an Objective-C

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.