I have used the following extension method on of my project, It might help you.
/// <summary>
/// Performs a left outer join on two collections.
/// </summary>
/// <typeparam name="TLeft">Type of left IEnumerable collection</typeparam>
/// <typeparam name="TRight">Type of left IEnumerable collection</typeparam>
/// <typeparam name="TKey">The type of the key returned by the key selector functions.</typeparam>
/// <typeparam name="TResult">The type of the result elements.</typeparam>
/// <param name="left"> The left IEnumerable collection of the join operation.</param>
/// <param name="right"> The right IEnumerable collection of the join operation.</param>
/// <param name="leftKeySelector">Function that projects the key given an element from <paramref name="left"/>.</param>
/// <param name="rightKeySelector">Function that projects the key given an element from <paramref name="right"/>.</param>
/// <param name="resultSelector">Function that projects the result given
/// an element from <paramref name="left"/> and
/// an element from <paramref name="right"/>
/// that match on a common key.</param>
/// <returns>A sequence containing results projected from a left outer join of the two input collections.</returns>
public static IQueryable<TResult> LeftJoin<TLeft, TRight, TKey, TResult>(
this IQueryable<TLeft> left,
IQueryable<TRight> right,
Expression<Func<TLeft, TKey>> leftKeySelector,
Expression<Func<TRight, TKey>> rightKeySelector,
Expression<Func<TLeft, TRight, TResult>> resultSelector)
{
if (left == null) throw new ArgumentNullException(nameof(left));
if (right == null) throw new ArgumentNullException(nameof(right));
if (leftKeySelector == null) throw new ArgumentNullException(nameof(leftKeySelector));
if (rightKeySelector == null) throw new ArgumentNullException(nameof(rightKeySelector));
if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector));
return left
.AsExpandable() // LinqKit to convert everything into an expression tree.
.GroupJoin(
right,
leftKeySelector,
rightKeySelector,
(leftItem, rightItem) => new { leftItem, rightItem })
.SelectMany(
joinResult => joinResult.rightItem.DefaultIfEmpty(),
(joinResult, rightItem) =>
resultSelector.Invoke(joinResult.leftItem, rightItem));
}
And this is how it was called
base.context.Users
.LeftJoin(
base.context.Workers
user => user.Userid,
worker => worker.Workerid,
(user, worker) => new
{
User = user,
Worker = worker
})
Got this answer here, Trying to implement a LeftJoin extension method to work with EF Core 2.0