在 vnext ,使用 Entity Framework 7 ( https://github.com/aspnet/EntityFramework ) 如何在模型中使用空间数据类型(例如 DbGeography
)(代码优先方法)在为表创建模型时保存点、形状等。
例如
public DbGeography gps_points {get; set;}
我无法使用
DbGeography
.更新:
已确认,此功能在 EF7 中尚不可用,但可能在 future 版本中可用。
要跟踪任何更改,请参阅:
https://github.com/aspnet/EntityFramework/issues/242
https://github.com/aspnet/EntityFramework/issues/1100
最佳答案
引用your own issue在 Entity Framework 的 github 存储库中,似乎还没有实现。由于里程碑设置为“Backlog”,这个问题似乎不会在不久的将来得到解决。
如果您不需要在数据库端按地理方式处理数据(例如,在边界框或交叉点中搜索),您可以将数据保存为 Well-known text .如果 EF7 将来支持空间数据,这可以轻松转换为数据库几何类型。
请注意数据库的字符串长度限制,因为 WKT 对于复杂的形状可能会变得很长。
关于asp.net-mvc - 如何在 EF 7 的 asp.net vnext 中使用空间数据类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27008634/