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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:07:57+00:00 2026-05-25T20:07:57+00:00

I am trying to make a library where I can specify query parameters and

  • 0

I am trying to make a library where I can specify query parameters and operators in an xml file and at runtime i can generate linq expressions based on an xml file. I have it working only on building the “where” expressions so simple queries such as select * from table where table.id = 1. Here is an example of a simple query in the xml file:

<query name="latest">
    <PropertyValue PropertyName="TimeStamp" OperatorName="GreaterThanOrEqual" ParamName="lastUpdated" />
</query>

The TimeStamp property name is the name of the Property in the C# class to use. The ParamName is a url parameter coming in from a http request in my asp.net application.
In the code i can build the linq expression out of this and make the following where clause:

(IQueryable<DataObject>)dataObjects.Where(expression);

where expression is:

TimeStamp >= "2011-09-21T11:54:24"

But i have a new type of query that i need to be able to handle:

select * from theTable t where Id=(select top 1 Id from theTable
where Source=t.Source order by Id desc)

This query runs on a table that has an Id field and a Source field. The query returns the newest entry per each Source. So it groups by source and orders it in descending order and returns the first entry for each source. Then the outer select returns all the columns for each of the results in the inner select. Example:
Table:

id   source     field3  field4
1    Device1    test    test
2    Device2    test2   test2
3    Device1    test3   test3
4    Device2    test4   test4

Results of the query:

id   source     field3  field4
3    Device1    test3   test3
4    Device2    test4   test4

So now i need to dynamically generate a nested query in the where clause. I guess my first question is can that string query be converted to a linq query? Then i need to be able to dynamically build that nested query somehow.. Sorry if it doesn’t make a lot of sense…

  • 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-25T20:07:58+00:00Added an answer on May 25, 2026 at 8:07 pm

    Maybe the PredicateBuilder is what you’re looking for?

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

Sidebar

Related Questions

I'm trying to make a library file. The .cpp file has some conditional compiled
I'm trying to make a python binding for the this library: http://code.google.com/p/hosterslib/ . I'm
Trying to make a make generic select control that I can dynamically add elements
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to make a generic PL/SQL procedure to export data in specific XML format,
I am trying to make LLVM inline a function from a library. I have
I am trying to make the installation of boost library a little bit slower,
I have an abstract class in a library. I'm trying to make it as
Okay so I'm trying to make a file browser program, and I'm in the
How can I use configure and make tools to specify to use 64 bit

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.