not supported for fields having DataTypeName 'public.geometr 返回

SqlSugar 沟通中
3 174
该叫什么 NIXUS 发布于2周前
悬赏:0 飞吻

读数据时报错:Reading as 'System.Object' is not supported for fields having DataTypeName 'public.geometry'。奇怪的是,有的地方调用又不报错。

/// Dto定义:
using NetTopologySuite.Geometries;

public class PageInput : BasePageInput
{
    public Geometry? Location { get; set; }
}

// 实体定义:
public class Entity: EntityBase
{
    /// <summary>
    /// 坐标(PostGIS geometry(Point,4326),X=经度,Y=纬度)
    /// </summary>
    [SugarColumn(ColumnName = "coordinates", ColumnDescription = "经纬度", ColumnDataType = "geometry(Point,4326)")]
    public virtual Geometry? Coordinates { get; set; }
}

var result = await 主表.AsQueryable()
    .LeftJoin<表1>((u, c) => u.CompanyId == c.Id)
    .LeftJoin<表2>((u, c, r) => u.RecruiterId == r.UserId)
    .LeftJoin<表3>((u, c, r, cat) => u.CategoryId == cat.Id)
    .OrderByDescending((u, c, r, cat) => u.CreateTime)
    .Select((u, c, r, cat) => new ZyyPositionOutput
    {
            // 其它字段
        Location = u.Coordinates,
    })
    .ToPagedListAsync(input.Page, input.PageSize);


热忱回答3

  • NIXUS NIXUS VIP0
    2周前

    数据库是pgsql

    0 回复
  • NIXUS NIXUS VIP0
    2周前

    依赖包的版本:

    image.png

    image.png

    0 回复
  • NIXUS NIXUS VIP0
    2周前

    找到原因了,我可以把这个帖子删掉吗?

    0 回复