如何删除我的 linq-to-entity 语句中的“半径”,以便它不会将搜索限制在半径范围内?
仅供参考 - 我希望我的查询搜索以“术语”开头的名称,并从最接近位置点的名称开始向外搜索,但不将其限制为半径
DbGeography location = DbGeography.FromText("POINT(" + longitude.ToString() + " " + latitude.ToString() + ")");
int radius = (50 * 5280); // 50 miles
var namesList = (from N in dbContext.Profiles
where N.FullName.StartsWith(term)
&& N.LocationPoints.Distance(location) <= radius
orderby N.LocationPoints.Distance(location) ascending
select new ProfileNameSearch {
label = N.FullName + " - " + N.Location,
value = N.FullName,
location = N.LocationPoints.Latitude.ToString() + "," + N.LocationPoints.Longitude.ToString()
}).Take(10).ToList();