使用GeographyPoint的ASP.NET Core 2.0 - 实体类型' CoordinateSystem'需要定义主键

时间:2017-11-30 10:17:22

标签: entity-framework-core asp.net-core-2.0

ASP.NET Core 2.0使用GeographyPoint - 实体类型' CoordinateSystem'需要定义主键

我的项目一直运作良好,直到我添加了GeographyPoint的新模型。

DatabaseEnsureCreate()期间会弹出此异常。

我被困住了,似乎无法超越这个。这是我的模型中的代码段:

    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Spatial;

    //Id
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    [Display(Description = "Id",Name = "Id", Prompt = "Id")]
    [ScaffoldColumn(true)]
    public new int Id { get; set; }


    //Geography Point
    [Column(TypeName = DatabaseExtension.TypeNameInteger)]
    [Display(Description = "Geography Point", Name = "Geography Point", 
    Prompt = "Geography Point")]
    [ScaffoldColumn(true)]
    public GeographyPoint Point { get; set; }

enter image description here

enter image description here

0 个答案:

没有答案