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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:09:30+00:00 2026-05-12T14:09:30+00:00

I am desperately trying to use LinqKits PredicateBuilder to allow the user to enter

  • 0

I am desperately trying to use LinqKits PredicateBuilder to allow the user to enter a search term into a text box and return records from two database tables/entitysets but I’m struggling to get anywhere. The (simplified) database structure is as follows:

Person                Alias
------                ------
                      A_ID
P_ID ---------------< P_ID
P_FIRST_NAME          A_FIRST_NAME
P_SURNAME             A_SURNAME

So, each person can have 0 or many aliases. What I am trying to do is allow the user to search on a name and pull back the rows from the Person table where that name matches that in either the Person or the Alias table. So far I have got:

        var peopleQuery = MainFrm.genesisContext.People.AsExpandable();
        var peoplePredicate = PredicateBuilder.True<Person>();

        var aliasQuery = MainFrm.genesisContext.Alias.AsExpandable();
        var aliasPredicate = PredicateBuilder.False<Alias>();

        if (!String.IsNullOrEmpty(txtFirstName.Text.Trim()))
        {
            peoplePredicate = peoplePredicate.And(p => p.P_FIRST_NAME == txtFirstName.Text);

            aliasPredicate = aliasPredicate.And(a => a.A_FIRST_NAME == txtFirstName.Text);

            peoplePredicate = peoplePredicate .Or(p => aliasPredicate);
        }

This doesn’t work because I’m trying to convert from People to Alias. Basically I’m completely stuck and not sure whether it is even possible to do an Or query on two different tables(?)

  • 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-12T14:09:30+00:00Added an answer on May 12, 2026 at 2:09 pm

    I can think of several possible solutions:

    1. Include the primary name of each person in the
      Alias table, and just search on the
      Alias table, or
    2. UNION the two tables together before
      the search, or
    3. Run a Linq query that outer joins the Alias table to the Person table,
      and use the result in your search,
      including your OR condition
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying, desperately, to get into C++ programming with DirectX. It's been a steep
I'm desperately trying to use json data to fill my dojo spider chart. First
Desperately trying to enable a widget from functions.php file... When I use it as
I am trying to use the JQGrid plugin and have run into an issue
currently I'm desperately trying to write german umlauts, read from the console, into a
I have been trying desperately to draw some images into a view. The view
I'm desperately trying to search the following: <texit info> author=MySelf title=MyTitle </texit> and replace
trying desperately to combine 2 simple answers into specifically what i need. sql loop
I am desperately trying to develop with RIA services, but I want the User
I am playing with things here above my head but am desperately trying to

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.