В этом запросе linq мне нужно применить условие where для выбора только tiertype. Я пробовал следующее, но получаю ошибку в условии where tiertype. Ошибка "ti in ti.ImageVersion ti не существует в текущем контексте.
var result = (from p in _context.Product
join ti in _context.TierImageMap on p.Id equals ti.ProductId
join t in _context.Tiers on ti.TierType equals t.Id
where (p.Id == productname)
orderby ti.ReleaseVersion descending
group new { ti, t } by new { ti.ImageName, t.TierType,ti.ImageVersion } into cities
select new
{
ReleaseVersion = string.Join(",", (from n in cities select n.ti.ReleaseVersion).Distinct().Take(3)),
ImageName = string.Join(",", (from n in cities select n.ti.ImageName).Distinct()),
TierType = string.Join(",", (from n in cities select n.t.TierType).Where(ti.ImageVersion== imageversion).Distinct())
//String.Format(ti.ReleaseVersion, ", ").GroupBy.OrderByDescending( ti.ImagDESeName ) as Releaseversion,
//String.Format(t.TierType, ", ").GroupBy.OrderByDescending( ti.ImageName ) as Tiertype
}).ToList().Distinct();
await _context.SaveChangesAsync();