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; }