我有一个 SQL Server 2008 数据库,geography
其中有一列由System.Data.Entity.Spatial.DbGeography
Entity Framework 6.0.0-alpha3 生成。
现在我需要用SqlDataReader
. 但我不知道该怎么做。使用旧上下文不是一种选择。我试图将其转换为DbGeography
:
Location = (DbGeography)reader.GetValue(index)
但我得到这个错误:
无法将“Microsoft.SqlServer.Types.SqlGeography”类型的对象转换为“System.Data.Entity.Spatial.DbGeography”类型
你有什么建议吗?