简体   繁体   中英

Using DbGeography Tyes with Entity Framework 7 and vNext

I am building an application that will use Spatial Data with vNext and 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.

Currently I have the following nuget packages in my project.json file:

  • "EntityFramework.Commands": "7.0.0-rc1-final"
  • "EntityFramework.Core": "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? 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.

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.

"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."

Source:

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. (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. (Spatial Data - Geography)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM