简体   繁体   English

如何使用C#,Entity Framework和SQL Server 2008读/写地理数据?

[英]How to read / write geography data using C#, Entity Framework and SQL Server 2008?

I have a form from which the user will be able to enter the latitude and longitude of a certain point on the map. 我有一个表单,用户可以从中输入地图上某个点的纬度和经度。 The data will be input as string values. 数据将作为字符串值输入。 I did some research and found out from various sources that the Entity Framework doesn't support geography data types. 我做了一些研究,并从各种渠道发现实体框架不支持地理数据类型。

  • How can I parse and/or save the string data to a geography column in a database? 如何将字符串数据解析和/或保存到数据库中的地理列?
  • How can I access it and reparse it as string once it is stored? 如何存储后,如何访问它并将其重新解析为字符串?

Thanks in advance! 提前致谢!

In fact Entity Framework 5 components that are shipped with .NET Framework 4.5 do support spatial types. 事实上,.NET Framework 4.5附带的Entity Framework 5组件确实支持空间类型。 Take a look at this walkthrough . 看看这个演练

EDIT With EF6 you can use spatial types on both .NET Framework 4 and .NET Framework 4.5 编辑使用EF6,您可以在.NET Framework 4和.NET Framework 4.5上使用空间类型

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

相关问题 SQL Server 2008中的空间数据/地理,OR映射器和C# - Spatial data/Geography in SQL Server 2008, OR mappers and C# 在C#实体中使用SQL Server Geography而不引用实体框架 - Using SQL Server Geography in C# entities without referencing Entity Framework 如何使用C#/ SQL Server 2008空间“平均”两个或更多地理线串 - How to “average” two or more geography linestrings using C#/SQL Server 2008 spatial 使用实体框架/ nhibernate与sql2008地理数据类型 - using entity framework/nhibernate with sql2008 geography datatype 如何从 SQL 服务器紧凑型 C# 在 Entity Framework 中更快地读取数据 - How to read data faster in Entity Framework from SQL Server Compact C# C#,实体框架和删除SQL Server 2008中的子寄存器 - C#, Entity Framework and delete child registers in SQL Server 2008 如何使用C#和实体框架实现SQL Server分页? - How to implement SQL Server paging using C# and entity framework? 在C#中从Entity Framework将数据写入两个SQL数据库 - Write data to two SQL databases from Entity Framework in c# C#实体框架/ SQL Server匹配数据的数量 - C# Entity Framework / SQL Server count number of matched data 如何使用C#实体框架获取SQL Server表/视图等中每一列的数据类型? - How can I get data type of each column in a SQL Server table/view etc. using C# Entity Framework?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM