I have a code like this:
var shops = (from p in dataContext.shops
let distance = dataContext.GetDistance(p.lat, p.lon, nearlat,nearlon)
join c in dataContext.shops_category on p.id equals c.poi_id
select new ShopsModel { p = p, distance = distance }
);
}
if(somthig)
shops.OrderBy(distance)
else
shops.OrderBy(p.name)
return shop.Take(30).ToList()
It works great except OrderBy. The generated SQL code does not contain the orderby clause, and the records are not sorted.
Any idea? Thanks for the help.
source
share