I have two Lists (List<>) that I want to perform outer join.
revisionsByDate looks like this:
DateCreated RevisionCount
10-09-2019 15
11-09-2019 17
12-09-2019 5
13-09-2019 7
progresUpdates looks like this:
DateCreated Progress
10-09-2019 60
13-09-2019 90
14-09-2019 100
I need to do an outer join on these List objects. I tried the following code, which works fine but does an inner join:
var resultsToReturn = revisionsByDate.Join(
progresUpdates,
revision => revision.DateCreated,
action => action.DateCreated,
(revision, action) => new {
revision.RevisionCount, action.Progress, action.DateCreated });
Output is:
DateCreated Progress RevisionCount
10-09-2019 60 15
13-09-2019 90 7
14-09-2019 100 0
But, I want to achieve the following:
DateCreated Progress RevisionCount
10-09-2019 60 15
11-09-2019 60 17
12-09-2019 60 5
13-09-2019 100 7
14-09-2019 100 0
You may notice that the latest progress 60 is repeated if there is no matching value for the DateCreated value of the revisionsByDate.
Any ideas to convert my code to outer join? Also, I wonder if I should do this already in sql? I am using Entity Framework Core.