The following syntax when migrated to EF Core has the following error

> 
> InvalidOperationException: The LINQ expression 'DbSet()
> .Join(
> inner: DbSet(),
> outerKeySelector: ij => ij.ImportDefinitionId,
> innerKeySelector: id => id.ImportDefinitionId,
> resultSelector: (ij, id) => new {
> ij = ij,
> id = id
> })
> .Join(
> inner: DbSet(),
> outerKeySelector: <>h\_\_TransparentIdentifier0 => <>h\_\_TransparentIdentifier0.id.ImportTypeId,
> innerKeySelector: it => it.ImportTypeId,
> resultSelector: (<>h\_\_TransparentIdentifier0, it) => new {
> <>h\_\_TransparentIdentifier0 = <>h\_\_TransparentIdentifier0,
> it = it
> })
> .GroupJoin(
> inner: DbSet(),
> outerKeySelector: <>h\_\_TransparentIdentifier1 => <>h\_\_TransparentIdentifier1.<>h\_\_TransparentIdentifier0.ij.ImportJobId,
> innerKeySelector: ijp => ijp.ImportJobId,
> resultSelector: (<>h\_\_TransparentIdentifier1, ijpGroup) => new {
> <>h\_\_TransparentIdentifier1 = <>h\_\_TransparentIdentifier1,
> ijpGroup = ijpGroup
> })' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly
> by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList',
> or 'ToListAsync'. See <https://go.microsoft.com/fwlink/?linkid=2101038>
> for more information.
> 
> 
> 

```
   (from ij in ImportJobs
             join id in ImportDefinitions
                 on ij.ImportDefinitionId equals id.ImportDefinitionId
             join it in ImportTypes
                 on id.ImportTypeId equals it.ImportTypeId
             join ijp in ImportJobParameters
                 on ij.ImportJobId equals ijp.ImportJobId into ijpGroup
             where ij.JobQueuedTimeUtc >= DateTime.Now.AddDays(-30)
             orderby ij.JobQueuedTimeUtc descending
             select
                 new
                 {
                     ImportDefinition = id,
                     ImportType = it,
                     LastImportJob = ij,
                     LastImportJobParameters = ijpGroup
                 }).ToList()

```

My attempt to change this is as follows

```
         (from ij in ImportJobs
             join id in ImportDefinitions
                 on ij.ImportDefinitionId equals id.ImportDefinitionId
             join it in ImportTypes
                 on id.ImportTypeId equals it.ImportTypeId
             from ijp in ImportJobParameters.Where(ijp => ij.ImportJobId == ijp.ImportJobId).DefaultIfEmpty()                 
             where ij.JobQueuedTimeUtc >= DateTime.Now.AddDays(-60)
             orderby ij.JobQueuedTimeUtc descending
             select
                 new
                 {
                     ImportDefinition = id,
                     ImportType = it,
                     LastImportJob = ij,
                     LastImportJobParameter = ijp
                 }).ToList()
                 .GroupBy(i => new { i.ImportDefinition, i.ImportType, i.LastImportJob })
               .Select(i => new { i.Key.ImportDefinition, i.Key.ImportType, i.Key.LastImportJob, LastImportJobParameters = i.Select(s => s.LastImportJobParameter) })

```

however this results in a IEnumerable of LastImportJobParameters having 1 item of null where previously there would be 0 items. Just wondering if there is an equivalent EF Core statement otherwise I will filter out once materialised.

\*\* Classes simplified \*\*

```
 public class ImportJob
{
    [Key]
    public int? ImportJobId { get; set; }

    [Required]
    public Int16? ImportDefinitionId { get; set; }

    [NotMapped]
    public ImportDefinition ImportDefinition { get; set; }

    public DateTime? JobQueuedTimeUtc { get; set; }

    [NotMapped]
    public List<ImportJobParameter> ImportJobParameters { get; set; }

}   

public class ImportJobParameter
{
    [Key]
    public int? ImportJobParameterId { get; set; }

    [Required]
    public int? ImportJobId { get; set; }

    [Required]
    public short? ImportParameterId { get; set; }

    public string ParameterName { get; set; }

    public string ParameterValue { get; set; }

}   

public class ImportDefinition
{
    [Key]
    public Int16? ImportDefinitionId
    {
        get;
        set;
    }
    [Required]
    [StringLength(255)]
    public string Name
    {
        get;
        set;
    }

    public ImportType ImportType
    {
        get;
        set;
    }

    [Required]
    public Int16? ImportTypeId
    {
        get;
        set;
    }

}

public class ImportType
    {
       [Key]
        public Int16? ImportTypeId
        {
            get; set; 
        }

        [Required]
        [StringLength(100)]
        public string Name 
        {
            get;
            set;
        }

    }

```