How to consume geography data stored in SQL Server using Entity Framework Core if geography data type is not yet supported and stored procedures too?
This is how i've done it. Obviously you don't get the features of the DbGeography type, but for simple queries it should suffice.
public async Task<List<PointOfInterest>> Execute(double latitude, double longitude, int radius)
{
return await this.context.PointsOfInterest.FromSql(
"DECLARE @point geography = geography::Point(@p0, @p1, 4326); " +
"SELECT Id, DateAdded, Latitude, Longitude " +
"FROM dbo.PointsOfInterest " +
"WHERE @point.STDistance(Location) <= @p2",
longitude,
latitude,
radius).ToListAsync();
}