I have a SQL Server 2008 database with a geography
column which is generated by System.Data.Entity.Spatial.DbGeography
in Entity Framework 6.0.0-alpha3.
Now I need to read that column with a SqlDataReader
. But I have no idea how to do this. Using the old context is not an option. I tried to cast it as DbGeography
:
Location = (DbGeography)reader.GetValue(index)
But I get this error:
Unable to cast object of type 'Microsoft.SqlServer.Types.SqlGeography' to type 'System.Data.Entity.Spatial.DbGeography'
Do you have any suggestion?