0

I've checked various posts about this, but my problem is not solved. I am using EF6, so my namespace is System.Data.Spatial, my reference is System.Data.Entity and still I get this error:

Geocoder.DbGeography: : EntityType 'DbGeography' has no key defined.
Define the key for this EntityType.
DbGeographies: EntityType: EntitySet 'DbGeographies' is based on type 'DbGeography' that has no keys defined.

My entity is like this:

public class Address
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Address { get; set; }
    public DbGeography Geo { get; set; }
}

What am I missing here?

YSFKBDY
  • 735
  • 1
  • 12
  • 38
  • This means that EF treaded `DbGeography` as a plain-old C# class, not a spatial type. [The docs](https://learn.microsoft.com/en-us/ef/ef6/modeling/code-first/data-types/spatial) show you have to reference the `System.Data.Entity` assembly and use the `System.Data.Spatial` namespace – Panagiotis Kanavos Jul 23 '20 at 13:51
  • @PanagiotisKanavos I am exactly doing this. – YSFKBDY Jul 23 '20 at 13:56

0 Answers0