简体   繁体   English

将DbGeography Tyes与Entity Framework 7和vNext一起使用

[英]Using DbGeography Tyes with Entity Framework 7 and vNext

I am building an application that will use Spatial Data with vNext and EF7. 我正在构建一个将空间数据与vNext和EF7一起使用的应用程序。 In the past with the current version of asp.net and EF6 I have used System.Data.Entity.Spatial in order to use the DbGeography however now this namespace is not available. 在过去使用当前版本的asp.net和EF6时,我使用了System.Data.Entity.Spatial来使用DbGeography但是现在这个命名空间不可用。

Currently I have the following nuget packages in my project.json file: 目前我的project.json文件中有以下nuget包:

  • "EntityFramework.Commands": "7.0.0-rc1-final" “EntityFramework.Commands”:“7.0.0-rc1-final”
  • "EntityFramework.Core": "7.0.0-rc1-final" “EntityFramework.Core”:“7.0.0-rc1-final”
  • "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final" “EntityFramework.MicrosoftSqlServer”:“7.0.0-rc1-final”

Is there a package that I am missing, or is support for Spatial Data Types with SQL Server something that has not been implemented yet? 是否有我缺少的软件包,或者是否支持SQL Server的空间数据类型尚未实现的东西? I notice that there is a backlog feature marked 'Modelling - Complex/value types' on the EF7 github Roadmap, but I don't see any specifics. 我注意到EF7 github路线图上有一个标记为“建模 - 复杂/值类型”的积压功能,但我没有看到任何细节。

If there is a package I am missing, what is the package so I can include it. 如果有一个我缺少的包,那么包装是什么,所以我可以包含它。

Many thanks in advance 提前谢谢了

Spatial data isn't supported yet by Entity Framework Core. Entity Framework Core尚不支持空间数据。

"Spatial is not planned for 2.0 and we haven't finished planning for the version after. It might be a good idea to post more details about what you would like to have in spatial support at github.com/aspnet/EntityFramework/issues/1100, eg do you use specific spatial functions or do you need rich spatial types with all kinds of spatial functionality, would you use this only with a specific database or do you need to write the same code against multiple databases? Etc." “空间不是针对2.0计划的,我们还没有完成后续版本的规划。在github.com/aspnet/EntityFramework/issues/上发布有关您希望获得空间支持的更多细节可能是一个好主意。 1100,例如,您是否使用特定的空间函数,或者您是否需要具有各种空间功能的丰富空间类型,您是仅将其用于特定数据库还是需要针对多个数据库编写相同的代码?等等。

Source: 资源:

http://github.com/aspnet/EntityFramework/issues/1100 https://blogs.msdn.microsoft.com/dotnet/2017/06/28/announcing-ef-core-2-0-preview-2/ http://github.com/aspnet/EntityFramework/issues/1100 https://blogs.msdn.microsoft.com/dotnet/2017/06/28/announcing-ef-core-2-0-preview-2/

Altought I have made a temporary workaround to include Geography column and use it in EF Core 1.0.0 and above. Altought我已经做了一个临时的解决方法,包括Geography列并在EF Core 1.0.0及更高版本中使用它。 (It's not perfect, but it will do for now) (这不是完美的,但它现在会做)

See the accepted answer on: 请参阅接受的答案:

Entity Framework Core: Type Udt is not supported on this platform. 实体框架核心:此平台不支持类型Udt。 (Spatial Data - Geography) (空间数据 - 地理)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实体框架5:DbGeography - Entity Framework 5: DbGeography DbGeography +实体框架5 + Silverlight + DomainService - DbGeography + entity framework 5 + Silverlight + DomainService 实体框架:SqlGeography与DbGeography - Entity Framework: SqlGeography vs DbGeography 未使用 vNext 在 Entity Framework 7 中添加导航属性 - Navigation Property Not being Added In Entity Framework 7 using vNext 实体框架DbGeography没有正确计算区域? - Entity Framework DbGeography not calculating the Area correctly? 实体框架核心支持SQL空间数据类型 - DBGeography? - Entity Framework Core support for SQL Spatial Data Types - DBGeography? 在Entity Framework中索引DbGeography类型是否会提高查询性能? - Would indexing a DbGeography type in Entity Framework improve query performance? 如何在Linq中使用DbGeography.Filter和Entity Framework 5? - How to use DbGeography.Filter in Linq with Entity Framework 5? 如何在 Code First Entity Framework 中返回 DbGeography.Distance 计算值而不丢失强类型? - How to return DbGeography.Distance calculated value In Code First Entity Framework without losing strong typing? 实体类型“DbGeography”需要定义主键 - The entity type 'DbGeography' requires a primary key to be defined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM