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

  • Home
  • SEARCH
  • 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 7688289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:53:09+00:00 2026-05-31T19:53:09+00:00

I am playing with a basic implementation of the Query Object pattern (in quotes

  • 0

I am playing with a basic implementation of the Query Object “pattern” (in quotes since this is an implementation of the interpreter pattern), and I was thinking of an enhancement which I do not know how to implement.

As you know a Criterion object would look something like the following:

public class Criterion
{
  ...
  string FieldName { get; set; }
  string Value { get; set; }
  ....
}

What I do not like is the fact that I have to add the field a string so I was thinking if I could create some kind of generic Criterion class so I could use it like so:

var criterion = new Criterion<Person>();
criterion.Field = c => c.FirstName;
criterion.Value = "John";

or something along those lines.

Of course there also would be the part where the criteria needs to be converted into SQL so I could do something like:

string query = "SELECT * FROM Person WHERE " + criteria.Field.ToString() + " = '" + criteria.Value + "'"

I am sure there’s got to be a way of doing this but I just can’t wrap my head around it.

Thanks for your help.

  • 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-31T19:53:10+00:00Added an answer on May 31, 2026 at 7:53 pm

    You can pretty easily do this with Expressions. This article has an example – Get property name and type using lambda expression

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

Sidebar

Related Questions

This basic menu works perfectly in all modern browsers but is not playing ball
I'm playing with TI-83+ BASIC development. But I want to know if I can
I'd like to know about basic classes for playing video from webcam I'd also
I'm playing around with JMock and get this error on a basic test: Does
I'm playing with HTTP Basic Authorization. As we all know, when a client gets
I started playing around with Celery and RabbitMQ this morning and defined some basic
Does anyone have some useful beginner tutorials and code snippets for playing with basic
I'm simply playing around with basic ActionScript 3 using Flash CS3 Pro. I put
I am currently learning about basic networking in java. I have been playing around
I've been playing today with stored procedures. I'm stoked that I picked the basic

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.