【发布时间】:2022-04-19 15:15:19
【问题描述】:
我正在尝试生成一个包含空间列的迁移文件(几何) 我收到了这个错误
没有为实体类型“CoordinateSystem”找到合适的构造函数。以下构造函数的参数无法绑定到实体类型的属性:无法在“CoordinateSystem(int epsgId, string name, Topology topology)”中绑定“epsgId”、“topology”。
是因为 SQL 不支持空间数据吗?
我要添加到数据库的模型:
public class Polygon
{
public int Id { set; get; }
public int AreaId { set; get; }
[ForeignKey("AreaId")]
public virtual Area Area { get; set; }
public Geometry Border { get; set; }
[Column(TypeName = "nvarchar(7)")]
public string Color { get; set; }
public DateTime SelectDate { get; set; }
}
【问题讨论】:
-
“是因为 SQL 不支持空间数据吗?” SQL Server 从 SQL Server 2008 开始就支持空间数据(如果我没记错的话)。
-
听起来您的数据库中没有
Geometry列,但您确实有CoordinateSystem。
标签: c# .net sql-server geospatial entity-framework-migrations