I have a following query throwing error as mentioned in subject
public async Task<IEnumerable<MyModel>> GetDataAsync()
{
return await _context.baseTable.SelectData().AsNoTracking().ToListAsync();
}
public static IQueryable<MyModel> SelectData(this IQueryable<relet> baseTable)
{
return baseTable
.Where(h => h.table1 != null && h.table1.table2 != null)
.Select(lev => new {
table3Collection = lev.table1.table2.table3, //table3 is ICollection
Table5Key = lev.table5 != null ? lev.table5.id : null,
Table4Key = lev.table1.table2.table4 != null ? lev.table1.table2.table4.id : null,
}).ToList()
.SelectMany(x => {
return x.table3Collection.Select(h => new MyModel() {
ContactKey = new Key
{
Id = h.Id,
Type = h.Type
},
Table5Key = x.Table5Key,
Table4Key = x.Table4Key
});
})
.AsQueryable();
}
Can someone Give me idea how to use same LINQ query in group join way? Problem is occuring at .ToListAsync() line