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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:14:06+00:00 2026-06-06T02:14:06+00:00

Lets say I need to fetch some records from the database, and filter them

  • 0

Lets say I need to fetch some records from the database, and filter them based on an enumeration type property.

  • fetch List<SomeType>
  • filter on SomeType.Size
  • enumeration Size { Small, Medium, Large }

when displaying records, there will be a predefined value for Size filter (ex Medium). In most of the cases, user will select a value from filtered data by predefined value.
There is a possibility that a user could also filter to Large, then filter to Medium, then filter to Large again.

I have different situations with same scenario:

  • List contains less than 100 records and 3-5 properties
  • List contains 100-500 records and 3-5 properties
  • List contains max 2000 records with 3-5 properties

What is my best approach here? Should I have a tab that will contain grid for each enum, or should I have one common enum and always filter, or?

  • 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-06-06T02:14:08+00:00Added an answer on June 6, 2026 at 2:14 am

    I would do the filtering right on the database, if those fields are indexed I would suspect having the db filter it would be much faster than filtering with c-sharp after the fact.

    Of course you can always cache the filtered database result as to prevent multiple unnescessary database calls.

    EDIT: as for storing the information in the database, suppose you had this field setup:

    CREATE TABLE Tshirts
    (
        id int not null identity(1,1),
        name nvarchar(255) not null,
        tshirtsizeid int not null,
        primary key(id)
    )
    
    CREATE TABLE TshirtSizes
    (
        id int not null, -- not auto-increment
        name nvarchar(255)
    )
    
    INSERT INTO TshirtSizes(id, name) VALUES(1, 'Small')
    INSERT INTO TshirtSizes(id, name) VALUES(2, 'Medium')
    INSERT INTO TshirtSizes(id, name) VALUES(3, 'Large')
    
    ALTER TABLE Tshirts ADD FOREIGN KEY(tshirtsizeid) REFERENCES tshirtsize(id)
    

    then in your C#

    public enum TShirtSizes 
    {
        Small = 1,
        Medium = 2,
        Large = 3
    }
    

    In this example, the table TshirtSizes is only used for the reader to know what the magic numbers 1, 2, and 3 mean. If you don’t care about database read-ability you can omit those tables and just have an indexed column.

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

Sidebar

Related Questions

Lets say I want to sort some items and need to sort them by
Lets say we need to select two sets from a table: Things var GradeA
Lets say you need to attach some JavaScript functionality to an ASP.NET User Control
Lets say I need to write several functions processing some data. These functions are
I need to process messages in batches, lets say of 10. After 10 transactions
I need to kill windows explorer's process (explorer.exe), for that lets say i use
Simple question: I need a solution so that I can find, lets say names,
Lets say I have a model similar to the one below, and I need
I have a datatable. I need to fetch a certain column value based on
I need some help on how to set up this page. Let's say I

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.