Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 如何在Entity Framework Core 1.0中将地理操作卸载到SQL Server_Sql Server_Geospatial_Spatial_Entity Framework Core - Fatal编程技术网

Sql server 如何在Entity Framework Core 1.0中将地理操作卸载到SQL Server

Sql server 如何在Entity Framework Core 1.0中将地理操作卸载到SQL Server,sql-server,geospatial,spatial,entity-framework-core,Sql Server,Geospatial,Spatial,Entity Framework Core,如果还不支持地理数据类型和存储过程,如何使用Entity Framework Core使用存储在SQL Server中的地理数据?我就是这样做的。显然,您没有得到DbGeography类型的特性,但是对于简单的查询,它应该足够了 public async Task<List<PointOfInterest>> Execute(double latitude, double longitude, int radius) { ret

如果还不支持地理数据类型和存储过程,如何使用Entity Framework Core使用存储在SQL Server中的地理数据?

我就是这样做的。显然,您没有得到DbGeography类型的特性,但是对于简单的查询,它应该足够了

  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();
        }
公共异步任务执行(双纬度、双经度、整数半径) { return wait this.context.PointsOfInterest.FromSql( 声明@point geography=geography::point(@p0,@p14326)+ 选择Id、添加日期、纬度、经度+ “来自dbo.PointsOfInterest”+
“其中@point.STDistance(位置)目前,如果你计划发布你的应用程序,你应该使用EF6。没有最终发布的日期…@Thomas不总是一个选项,例如,如果目标是UWPohh…对不起^^你看到这个问题了吗?是的,事实上,我写的最后一篇文章有这样的问题。你如何映射你的财产“位置”?位置是sys.geog是的,但您是如何在model/fluent api中声明它的?我有一个类似的问题:我想我只是将它作为字符串映射到了我的模型中,然后添加了一个迁移,使用builder.Sql()方法将列更改为地理类型。您对该字段执行的任何查询/命令都需要使用原始Sql。@Eli See