首页 > 解决方案 > EntityType 'DbGeography' 没有在 EF6 上定义的键

问题描述

我已经检查了有关此的各种帖子,但我的问题没有解决。我使用的是 EF6,所以我的命名空间是System.Data.Spatial,我的参考是System.Data.Entity,但我仍然收到此错误:

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.

我的实体是这样的:

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

我在这里想念什么?

标签: c#entity-frameworkentity-framework-6sqlgeography

解决方案


推荐阅读