I'm generating Entity SQL to provide dynamic query support in my application. I have however been unable to find how one is able to specify spatial conditions in Entity SQL using Entity Framework 5.
A query using Linq to Entities against a model with an entity containing a spatial field like:
var a = new Model1Container();
var b = from c in a.Entity1
where c.Loc.Intersects(System.Data.Spatial.DbGeography.FromText("POINT (43 -73)"))
select c;
generates the SQL that one would expect for SQL Server 2012, such as:
SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Loc] AS [Loc]
FROM [dbo].[Entity1] AS [Extent1]
WHERE ([Extent1].[Loc].STIntersects(geography::Parse(N'POINT (43 -73)'))) = 1
How does one rewrite the above Linq to Entities query using ESQL? Or is this impossible?