C# 如何从npgsql反序列化geojson多边形
我在尝试使用ef core 3.1获取实体表单npgsql时遇到以下异常C# 如何从npgsql反序列化geojson多边形,c#,.net,deserialization,geojson,C#,.net,Deserialization,Geojson,我在尝试使用ef core 3.1获取实体表单npgsql时遇到以下异常 System.NotSupportedException: Deserialization of reference types without parameterless constructor is not supported. Type 'GeoJSON.Net.Geometry.Polygon' 我的实体: public class VoteEntity : IVoteEntity {
System.NotSupportedException: Deserialization of reference types without parameterless constructor is not supported. Type 'GeoJSON.Net.Geometry.Polygon'
我的实体:
public class VoteEntity : IVoteEntity
{
public Guid Id { get; set; }
[Column(TypeName = "jsonb")]
public Polygon Coordinates { get; set; }
}
异常的意思是-您的实体中需要一个无参数构造函数 因此,您的实体应为:
public class VoteEntity : IVoteEntity
{
public Guid Id { get; set; }
[Column(TypeName = "jsonb")]
public Polygon Coordinates { get; set; }
//constructor
public VoteEntity ()
{
//you might want to initialise your properties here
}
}
异常的意思是-您的实体中需要一个无参数构造函数 因此,您的实体应为:
public class VoteEntity : IVoteEntity
{
public Guid Id { get; set; }
[Column(TypeName = "jsonb")]
public Polygon Coordinates { get; set; }
//constructor
public VoteEntity ()
{
//you might want to initialise your properties here
}
}