Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从npgsql反序列化geojson多边形_C#_.net_Deserialization_Geojson - Fatal编程技术网

C# 如何从npgsql反序列化geojson多边形

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 {

我在尝试使用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
    {
        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
    }
}