Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use List<JObject>to complete multiple joins through strings, and how to implement multiple connection conditions? #740

Closed
liuzhaolei107 opened this issue Aug 24, 2023 · 5 comments
Assignees
Labels

Comments

@liuzhaolei107
Copy link

liuzhaolei107 commented Aug 24, 2023

Description

Creates two Lists:

List<JObject> list1 = new List<JObject>
{
    new JObject { {"id", 1}, {"name", "John" } },
    new JObject { {"id", 2}, {"name", "Jane" } }
};

List<JObject> list2 = new List<JObject>
{
    new JObject { {"id", 1}, {"age", 25 } },
    new JObject { {"id", 2}, {"age", 30 } },
    new JObject { {"id", 3}, {"age", 35 } }
};

var joinedResult = list1.AsQueryable()
                         .Join(list2.AsQueryable(),
                               j1 => j1.Value<int>("id"),
                               j2 => j2.Value<int>("id"),
                               (j1, j2) => new JObject
                               {
                               { "id", j1["id"] },
                               { "name", j1["name"] },
                               { "age", j2["age"] }
                               });

If there is no question, ask how to describe it in a plain way. How to write if there are many linked conditions?

@liuzhaolei107 liuzhaolei107 changed the title How to use List<JOObject>to complete multiple joins through strings, and how to implement multiple connection conditions? How to use List<JObject>to complete multiple joins through strings, and how to implement multiple connection conditions? Aug 24, 2023
@liuzhaolei107
Copy link
Author

image

@StefH
Copy link
Collaborator

StefH commented Oct 29, 2023

@liuzhaolei107
Sorry, I do not understand your question.

Please rephrase or create a https://dotnetfiddle.net/ to show to error.

@liuzhaolei107
Copy link
Author

liuzhaolei107 commented Oct 29, 2023 via email

@StefH
Copy link
Collaborator

StefH commented Dec 5, 2023

@liuzhaolei107
Sorry, I do not understand your question.

Please rephrase or create a https://dotnetfiddle.net/ to show to error.

@liuzhaolei107
Copy link
Author

liuzhaolei107 commented Dec 5, 2023 via email

@StefH StefH closed this as completed Dec 5, 2023
@StefH StefH self-assigned this Dec 5, 2023
@StefH StefH added the question label Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants