I've included Microsoft.SqlServer.Types
to enable the geography and geometry types in Entity Framework, but I don't see any functions equivalent to STContains()
.
I need to make a query to retrieve the geography that contains a point
In SQL I wrote like this:
SELECT adm1code, adm1name
FROM Adm2GeoBoundaries
WHERE Coords.STContains(geography::Parse('POINT(-121.703796 46.893985)'));
in LINQ I expect to have something like
using (GeoEntities db = new GeoEntities ())
{
DbGeography location = DbGeography.FromText("POINT(-121.703796 46.893985)");
var admin = from a in db.Adm2GeoBoundaries
where a.Coords.STContains(location)
select a;
}
but a.Coords.STContains(location)
throws an error
STContains method doesn't exist