我有lat和長的SQL數據庫作爲「浮動」C#LINQ SqlGeography - 找到緯度和經度
我想下面的地方緯度& LNG儲存在50m以內的位置是C#雙
var yourLocation = SqlGeography.Point(lat, lng, 4326);
MyConn conn = new MyConn();
var query = from p in conn.Locations
let distance = SqlGeography
.Point(p.Latitude, p.Longitude, 4326)
.STDistance(yourLocation)
.Value
where distance <= 50
select p;
return query.Distinct().ToList();
我得到的是下面的錯誤
LINQ到實體無法識別方法「System.Data.SqlTypes.SqlDouble STDistance(Microsoft.SqlServer.Types.SqlGeography)」的方法,而且這種方法不能被翻譯成商店表達。
對此有何看法?