I'm trying to join two tables without any relationship. Here's the simplified version of what I try to reach.
First table has these values:
| Address | SomeOtherID |
|---|---|
| XYZ | NULL |
| ABC | 3 |
| DEF | NULL |
| GHI | 2 |
The other table has these values:
ID NAME 1 Alice 2 ... 3 ...
| ID | NAME |
|---|---|
| 1 | Alice |
| 2 | Bob |
| 3 | Cedric |
| 4 | Diana |
I need to join these two so I obtain something like this:
ID NAME Address SomeOtherID 1 Alice NULL NULL 2 Bob GHI 2
| ID | NAME | Address | SomeOtherID |
|---|---|---|---|
| 1 | Alice | NULL | NULL |
| 2 | Bob | GHI | 2 |
| ... | ... | ... | ... |
| ... | ... | ... | ... |
For the moment I have this:
var candidates = dbContext.Candidate.Include(x => x.CandidateClass.Eassessment.EassessmentTranslations)
.Join(_dbContext.CandidateExternalInvoiceAdress, x => x.CandidateExternalInvoiceId, y=> y.Id, (cdte, cdteEIA) => new { cdte, cdteEIA })
This gives me only when the two numbers match, but x.CandidateExternalInvoiceId is an int? and y.Id is an int. I want in the case that the first Id is null, then it joins a null object of cdteEIA.