实体框架中的Linq问题?
是否有人可以优化此linq in实体:实体框架中的Linq问题?,linq,formula,Linq,Formula,是否有人可以优化此linq in实体: <code> var query = from s in context.Spots where (s.Lat - s.Long) <= radius orderby (s.Lat - s.Long) ascending select new { SpotId = s.SpotId, Distance = (s.Lat - s.Long)}; </code>
<code>
var query = from s in context.Spots
where (s.Lat - s.Long) <= radius
orderby (s.Lat - s.Long) ascending
select new { SpotId = s.SpotId, Distance = (s.Lat - s.Long)};
</code>
var query=来自context.Spots中的s
其中(s.Lat-s.Long)可以使用:
var query=来自context.Spots中的s
设dist=(s.Lat-s.Long)
哪里区
var query = from s in context.Spots
let dist = (s.Lat - s.Long)
where dist <= radius
orderby dist ascending
select new { SpotId = s.SpotId, Distance = dist};