none
there's NO way to pass a SqlGeometry column in a table-valued parameter ; it is not supported ... RRS feed

  • Question

  • how about making the next entity framework support spatial-indexes? this should solve a lot of other problems, including this one...
    Friday, May 30, 2014 7:02 AM

Answers

  • No, but you can pass it as WKT or WKB and re-convert it on the server.  That's what would happen anyway, as the client-side object has to be serialized for sending to the server.

    And, on spatial support for EF are you asking for?

    EF can already translate spatial queries to TSQL which would use a spatial index.  eg

        var myLocation = DbGeography.FromText("POINT(-122.296623 47.640405)"); 
     
        var university = (from u in context.Universities 
                            orderby u.Location.Distance(myLocation) 
                            select u).FirstOrDefault(); 

    Spatial - Code First (EF5 onwards)

    David


    David http://blogs.msdn.com/b/dbrowne/

    Saturday, May 31, 2014 4:35 PM

All replies

  • No, but you can pass it as WKT or WKB and re-convert it on the server.  That's what would happen anyway, as the client-side object has to be serialized for sending to the server.

    And, on spatial support for EF are you asking for?

    EF can already translate spatial queries to TSQL which would use a spatial index.  eg

        var myLocation = DbGeography.FromText("POINT(-122.296623 47.640405)"); 
     
        var university = (from u in context.Universities 
                            orderby u.Location.Distance(myLocation) 
                            select u).FirstOrDefault(); 

    Spatial - Code First (EF5 onwards)

    David


    David http://blogs.msdn.com/b/dbrowne/

    Saturday, May 31, 2014 4:35 PM
  • yes, wkt would solve it; but spatial queries in EF , instead of using the spatial index of a sql-server-table, always do FULL-TABLE-SCANS which is awful.
    Friday, June 13, 2014 5:32 AM