EntityType 'DbGeography' has no key defined

This turned out to be the opposite of what I read from Microsoft's own response about a similar issue at Codeplex here, and even their documentation here. Did I interpret it wrong? Both of those links indicate that in EF 6, the DbGeography datatype was moved from System.Data.Entity.Spatial to just System.Data.Spatial, but the reverse seems true.

I changed

using System.Data.Spatial;

to

using System.Data.Entity.Spatial;

and it works.


For anyone else whose might be facing this issue with EF6 (in 2021), try using System.Data.Spatial.DbGeographyWellKnownValue instead of System.Data.Spatial.DbGeography.

This solved my issue. (Not familiar with the intricate details though on how the error is resolved by this.)